0

I need to have actionbar size in the dimens resources folder , I need to have different size for different api version .

I've tried these code but all of then ran into an error :

?android:attr/actionBarSize
?attr/actionBarSize
?actionBarSize

when I launch the app ,I get this error :

 You must supply a layout_height attribute.

how can I put actionbar size in the resource folder ?

Navid Abutorab
  • 1,667
  • 7
  • 31
  • 58

1 Answers1

0

This works for me:

<androidx.appcompat.widget.Toolbar
    :
    android:layout_height="?attr/actionBarSize"
    android:theme="@style/AppBarTheme" />

with:

<style name="AppBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
    :
</style>

EDIT: I also have this:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Using the toolbar so no need to show action bar or title -->
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    :
</style>
Edmund Johnson
  • 709
  • 8
  • 15