Why is there a difference between theme defined in AndroidManifest.xml and theme taken from styles.xml?
1) AndroidManifest.xml:
<application ... android:theme="@android:style/Theme.Black">
2) AndroidManifest.xml
<application ... android:theme="@style/AppTheme">
styles.xml
<resources>
<style name="AppTheme" parent="@android:style/Theme.Black" />
</resources>
1st setting gives black theme and no action bar. 2nd has dark action bar and light menu.
EDIT : options 1) and 2) - notice Menu and ActionBar
EDIT 2:
Why doesn't the 2nd option actually use the AppTheme (Theme.Black) ? (tested on SGS3)
A style is a collection of attributes that specify the appearance for a single View . A style can specify attributes such as font color, font size, background color, and much more. A theme is a collection of attributes that's applied to an entire app, activity, or view hierarchy—not just an individual view.
There is no functional difference between styles. xml and themes.
A style is defined in an XML resource that is separate from the XML that specifies the layout. This XML file resides under res/values/ directory of your project and will have <resources> as the root node which is mandatory for the style file. The name of the XML file is arbitrary, but it must use the . xml extension.
xml file in the new Android Studio. Goto your project file view: Res>Values>Themes folder. Open themes. xml file change actionbar.
@android:style/Theme.Black
implements the exact theme implemented by Android (or device manufacturer). However, @style/AppTheme
allows you to perform custom modification in your theme which actually extends the original Theme.Black from android, and in order to perform custom modifications, you use style resources.
In simple words, its just like using Activity class or YourOwnActivity class which extends Activity with extra features inside.
You probably have another styles.xml
file, perhaps under a directory like "values-v11", that is defining the @style/AppTheme
differently than @android:style/Theme.Black
and taking precedence over the file you're viewing/modifying.
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