Attribute extension in styles in Android

I have Buttonas follows:

  <Button
    android:id="@+id/previousQuestion"
    style="?android:attr/buttonBarButtonStyle"
    android:text="@string/questions_activity_previous_button"
    android:onClick="previousButton_OnClick"
  />

but I want to add another style attribute that simplifies the work Button, so instead I'm going to put them in my own resource Style.

Question: "How will I use ?android:attr/buttonBarButtonStyle?" I tried to do the following but did not work:

<style name="PreviousQuestionButtonStyle" parent="android:attr/buttonBarButtonStyle">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:layout_alignParentLeft">true</item>
</style>

Any ideas?

+4
source share
1 answer

Try replacing this.

<style name="PreviousQuestionButtonStyle" parent="android:attr/buttonBarButtonStyle">

with this

<style name="PreviousQuestionButtonStyle" parent="@android:style/ButtonBar">
+2
source

All Articles