私もこれについて疑問に思っていたので、簡単なテストアプリを書いて試してみました。Resources ファイルは次のようになります。
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
<style name="AppTheme.TestTheme" parent="android:Theme.Light">
</style>
そこで、マニフェスト ファイルのアクティビティに AppTheme.TestTheme を適用します。AppTheme は、ウィンドウを全画面表示にし、タイトル バーを表示しません。Theme.Light は、ウィンドウの背景をデフォルトの暗い色から明るい色にします。属性が指定されている場合parent="android:Theme.Light"
、ウィンドウは白でフルスクリーンではありません。これは、parent="..."
属性が名前のプレフィックスよりも優先され、階層が のように見えることを意味しますTestTheme <- Theme.Light (light) <- Theme (dark)
。
parent="android:Theme.Light" を削除すると、画面が暗くフルスクリーンになるため、TestTheme <- AppTheme (fullscreen) <- AppBaseTheme <- Theme (dark)
階層が配置されます。
が指定されている場合parent="..."
、プレフィックスを削除しても削除しても違いはありません。そのparent="..."
ため、間違いなく優先されるようです。AppTheme.TestTheme は両方の親から一度に継承しません。
ここで、デフォルトの themes.xml を見ると、Theme.Holo.Light が Theme.Light を継承しているように見えます。そして、Holo のすべてがその説明で手動で指定されています。そのため、Theme.Holo.Light という名前を付けたのは、Holo を継承しているからではなく、「Holo のライト バージョン」として説明する名前が欲しかったからです。そして、彼らは $@&!ing を混乱させたかったからです。
これは Gingerbread 2.3.3 でテストされました。