I am unable to understand what happens with AppBaseTheme in Android. In styles.xml I have the following code
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="mycolor">
<item name="android:background">@layout/header_gradient</item>
<item name="android:padding">5dip</item>
</style>
<style name="myParentTheme" parent="android:Theme.Light">
<item name="android:attr/windowTitleSize">40dip</item>
<item name="android:attr/windowTitleBackgroundStyle">@style/mycolor</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
</style>
In AndroidManifest.xml when I use android:theme="@style/myParentTheme" the color and size of the title are set to what I want to set. But the style for text fields changes to the old regular textboxes. When I use android:theme="@style/AppTheme" the UI looks very "Android-like" but my specific settings to the title do not have any effect. Removing parent="AppBaseTheme" makes the AppTheme style behave just like the myParentTheme style.
Additionally, why do I not see all R.attr elements when I do Ctrl+Space while typing in the name attribute of the Style tag?
Please help. Thanks.
TextAppearance allows you to define text-specific styling while leaving a View 's style available for other uses. Note, however, that if you define any text attributes directly on the View or in a style, those values would override the TextAppearance values.
Use with the <application> tag to supply a default banner for all application activities, or with the <activity> tag to supply a banner for a specific activity. The system uses the banner to represent an app in the Android TV home screen.
A theme is nothing but an Android style applied to an entire Activity or application, rather than an individual View. Thus, when a style is applied as a theme, every View in the Activity or application will apply each style property that it supports.
You will need to press and hold on the icon that has your initials, or your profile picture, in this case where it say BTS, until you see a message on your screen that will say "Debug Settings Enabled". Tap the slider to enable Persistent app. Your Android app will now be continually running in the background.
If you choose to create an activity using the Eclipse new-project wizard, Eclipse will define AppTheme
and AppBaseTheme
resources for you. AppBaseTheme
typically will have three definitions, in res/values/
, res/values-v11/
, and res/values-v14/
. AppTheme
will inherit from AppBaseTheme
.
The intent is for you to put most of your app-specific style information in AppTheme
, rather than inventing your own theme (e.g., myParentTheme
). AppBaseTheme
would mostly ensure that you are inheriting from the right OS-supplied theme (e.g., Theme.Light
vs. Theme.Holo.Light
vs. Theme.Holo.Light.DarkActionBar
). You can also add version-specific style information to the appropriate AppBaseTheme
if you wish.
In
AndroidManifest.xml
when I useandroid:theme="@style/myParentTheme"
the color and size of the title are set to what I want to set. But the style for text fields changes to the old regular textboxes.
That is because you are inheriting from Theme.Light
, which uses the original (non-holographic) widget set.
When I use
android:theme="@style/AppTheme"
the UI looks very "Android-like" but my specific settings to the title do not have any effect.
That is because you decided to create myParentTheme
instead of putting your style definitions into AppTheme
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With