Reputation: 11447
I want to overload how an android Button
looks, except I want to overload only one attribute i.e. the android:background
. I know I could write something like:
<style name="App_TextButtonStyle" parent="???">
<item name="android:background">@drawable/filled_roundededges_nostroke</item>
</style>
Where parent="???"
specifies which style I inherit from. My question is which style should I inherit from do that I get everything from the android default style for buttons and just define a new background.
Upvotes: 1
Views: 1625
Reputation: 11447
This is mostly for future visitors, I found a solution to the problem:
<style name="App_TextButtonStyle" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/filled_roundededges_nostroke</item>
</style>
@android:style/Widget.Button
references the default style of the button in the currently selected theme. You could also use the holo widget button style @android:style/Widget.Holo.Button
(available since api 11).
You might want to look in <android-sdk-install-folder>/platforms/android-XX/data/res/values
for the files styles.xml
and themes.xml
to check out all styles android uses for a given platform version.
Upvotes: 1
Reputation: 782
I have used style for buttons without specifying "parent" attribute
<style name="BigButtonStyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:background">@drawable/backbutton</item>
<item name="android:textColor">#FFFFFF</item>
<item name="android:textSize">8pt</item>
<item name="android:textStyle">bold</item>
<item name="android:layout_margin">10pt</item>
</style>
I think it could be enough for you to define your style without "parent".
Upvotes: 1