0

I have been using this answer https://stackoverflow.com/a/11253806/2014236 to style an activity with a dialog theme so that it looks like an AlertDialog. However I would like to use the 'attr's available in the support library. How do I reference the android.support.v7.appcompat.R.attr version of buttonBarButtonStyle instead of the android.R.attr one that is used here:

<Button style="?android:attr/buttonBarButtonStyle"
        android:layout_height="wrap_content"
        android:layout_weight="wrap_content"
        android:text="Button" />

I have tried to use style="?android.support.v7.appcompat:attr/buttonBarButtonStyle" but this returns the error:

Error: No resource found that matches the given name (at 'style' with value '?android.support.v7.appcompat:attr/buttonBarButtonStyle')

despite it being in the specified package as is shown here: https://developer.android.com/reference/android/support/v7/appcompat/R.attr.html#buttonBarButtonStyle.

What is the correct format for using non-android attrs/styles?

Community
  • 1
  • 1
Uwais A
  • 737
  • 6
  • 23

1 Answers1

0

Looks like this works well.

<Button style="?attr/buttonBarButtonStyle"
        android:layout_height="wrap_content"
        android:layout_weight="wrap_content"
        android:text="Button" />
vangorra
  • 1,631
  • 19
  • 24