0

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

Pouria Hemati
  • 647
  • 5
  • 13
  • 29

3 Answers3

4

You should use

?android:attr/actionBarSize

XML

android:layout_height="?android:attr/actionBarSize"
IntelliJ Amiya
  • 73,189
  • 14
  • 161
  • 193
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
  • 52,662
  • 21
  • 188
  • 195
0

You should use this

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

instead of

android:layout_height="?attr/actionBarSize"
Faysal Ahmed
  • 7,003
  • 5
  • 27
  • 47