8

I am confused about "?actionbarsize","?attr:actionbarsize", "?android:actionBarSize"? and ?android:attr/actionBarSize

I see there are actionbarSize in appcompat-v7 but how this all diffrent value are works.

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
Jaydeep purohit
  • 1,536
  • 17
  • 20
  • When using AppCompat you usually have to declare twice your styles, one with the `android:` prefix and one without. This in order to be able to load the styles effectively across different devices and O.S. – DarkCygnus May 27 '16 at 05:21
  • Possible duplicate of [What's the difference between @android: and ?android:](http://stackoverflow.com/questions/16684131/whats-the-difference-between-android-and-android) – Dhaval Parmar May 27 '16 at 05:25

1 Answers1

2

?attr

The ?attr: syntax is used for accessing attributes of current theme.

@android

you want to access a style attribute that's defined in a style theme

EX :

<Toolbar  
    android:layout_height="?android:attr/actionBarSize" //?android
    android:layout_width="match_parent"
    android:background="?android:attr/colorPrimaryDark"
    android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar" /> //@android

check accessing-resources guides from developer.android.com

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142