getting implicitly defined values in java

2020-02-14 java android android-studio

Some attributes are defined in xml with sort of a question mark as given below for the layout_height of the toolbar:

<androidx.appcompat.widget.Toolbar
        android:id="@+id/app_toolbar"
        android:layout_width="0dp"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:textSize="@dimen/actionBarTextSize"
        app:titleTextColor="#929292"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
</androidx.appcompat.widget.Toolbar>  

How do you get these values in java? Say I instantiated the toolbar in java and want to set the height and use the actionBarSize defined by the variable in the xml above, how do I do that?

Answers

Related