Posts

Showing posts with the label Styles

Android: Styling Overflow Menu In Action Bar

Answer : I did it this way: <style name="Theme.yourapp" parent="@style/Theme.AppCompat.Light.DarkActionBar"> <item name="android:actionBarWidgetTheme">@style/Theme.yourapp.Widget</item> </style> <style name="Theme.yourapp.Widget" parent="@style/Theme.AppCompat"> <item name="android:textColor">@android:color/black</item> </style> For simplicity, the android: namespace pertains to anything built into the OS while anything without android: as the namespace would pertain to your application (and the libraries you are using). Most, if not all, support libraries for the ActionBar will try to use the native ActionBar implementation and therefor use the android: namespace attributes in your styles. When the native ActionBar is not available it would use the libraries implementation and the non- android: namespaced attributes. This is why you must specify every attribute w...

Android Button TextAppearance

Answer : The values of attributes defined using textAppearance are applied before the values of attributes in a style. A Button is a TextView with a style applied, and the default style of a Button will override your textAppearance (Android 2.3 for example will set it to ?android:attr/textAppearanceSmallInverse) and textColor. textAppearance excepts styles as values, android:textAppearance="@style/login_button_text_appearance" is the normally correct way to set a textAppearance, but not for a Button : If you're changing the text colour of a Button , you should also enforce a custom background image because if you don't, one device will use a dark background image (motorola defy) and another will use a light image (htc desire) which may make the text difficult to read. I think you should use : style = "@style/login_button_text_appearance" instead of: android:textAppearance="@style/login_button_text_appearance" The android:textAppe...