0

after update android studio to version 3.1.4 Can not use ?attr/actionBarSize in xml.

Pouria Hemi
  • 706
  • 5
  • 15
  • 30

3 Answers3

4

You should use

?android:attr/actionBarSize

XML

android:layout_height="?android:attr/actionBarSize"
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198
1

You can use the ?attr/actionBarSize still, the issue is that Android Studio is showing error on ?attr/actionBarSize. Almost every android developer has faced this issue in AS 3+.

Solution

  • Close project
  • Open project again (not from recent)

Resolved! :)

By the way, all below works still

android:layout_height="?actionBarSize"
android:layout_height="?android:actionBarSize"
android:layout_height="?attr/actionBarSize"

Related question :

Why does Android Studio highlight "Theme" red in styles.xml?

Cannot resolve symbol Theme, ThemeOverlay

Khemraj Sharma
  • 57,232
  • 27
  • 203
  • 212
0

You should use this

android:layout_height="?android:attr/actionBarSize"

instead of

android:layout_height="?attr/actionBarSize"
Faysal Ahmed
  • 7,501
  • 5
  • 28
  • 50