Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Make default holo button opaque

By default, the buttons in ICS are a little bit transparent. I would like to accomplish that the button keeps all its properties (shape, color, state pressed), but than make it opaque.

How could I achieve that?

Thanks in advance!

like image 782
Xander Avatar asked Feb 13 '26 22:02

Xander


1 Answers

You can create a style for the button extending the default style (if you are using Holo.Light):

<style name="GreenButton" parent="android:Widget.Holo.Button">
    <item name="android:background">#00ff00</item>
</style>

Then apply the style manually to the button with the style attribute or, if you want to change all buttons, set the buttonStyle in your app's theme:

<style name="AppTheme" parent="android:Theme.Holo">
    <item name="android:buttonStyle">@style/GreenButton</item>
</style>
like image 139
brillenheini Avatar answered Feb 16 '26 10:02

brillenheini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!