fix markup errors in action bar styling,
add more information about using drawables, move 'managing the activity lifecycle' down a notch, because it's less interesting. Change-Id: I75012207bfaa499ca881ec5cc3a94e8d66addbad
This commit is contained in:
@@ -74,7 +74,21 @@ is available in the action bar, but the
|
|||||||
Settings action should always appear in the overflow. (By default, all actions appear in the
|
Settings action should always appear in the overflow. (By default, all actions appear in the
|
||||||
overflow, but it's good practice to explicitly declare your design intentions for each action.)
|
overflow, but it's good practice to explicitly declare your design intentions for each action.)
|
||||||
|
|
||||||
<p>However, <strong>if your app is using the Support Library</strong> for compatibility on versions
|
<p>The {@code icon} attribute requires a resource ID for an
|
||||||
|
image. The name that follows {@code @drawable/} must be the name of a bitmap image you've
|
||||||
|
saved in your project's {@code res/drawable/} directory. For example,
|
||||||
|
{@code "@drawable/ic_action_search"} refers to {@code ic_action_search.png}.
|
||||||
|
Likewise, the {@code title} attribute uses a string resource that's defined by an XML
|
||||||
|
file in your project's {@code res/values/} directory, as discussed in <a
|
||||||
|
href="{@docRoot}training/basics/firstapp/building-ui.html#Strings">Building a Simple User
|
||||||
|
Interface</a>.
|
||||||
|
|
||||||
|
<p class="note"><strong>Note:</strong> When creating icons and other bitmap images for your app,
|
||||||
|
it's important that you provide multiple versions that are each optimized for a different screen
|
||||||
|
density. This is discussed more in the lesson about <a
|
||||||
|
href="{@docRoot}training/basics/supporting-devices/screens.html">Supporting Different Screens</a>.
|
||||||
|
|
||||||
|
<p><strong>If your app is using the Support Library</strong> for compatibility on versions
|
||||||
as low as Android 2.1, the {@code showAsAction} attribute is not available from
|
as low as Android 2.1, the {@code showAsAction} attribute is not available from
|
||||||
the {@code android:} namespace. Instead this attribute is provided by the Support Library
|
the {@code android:} namespace. Instead this attribute is provided by the Support Library
|
||||||
and you must define your own XML namespace and use that namespace as the attribute prefix.
|
and you must define your own XML namespace and use that namespace as the attribute prefix.
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ trainingnavtop=true
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="{@docRoot}guide/topics/ui/themes.html">Styles and Themes</a></li>
|
<li><a href="{@docRoot}guide/topics/ui/themes.html">Styles and Themes</a></li>
|
||||||
<li><a class="external-link" target="_blank"
|
<li><a class="external-link" target="_blank"
|
||||||
href="http://jgilfelt.github.io/android-actionbarstylegenerator/">Android Action Bar Style
|
href="http://www.actionbarstylegenerator.com">Android Action Bar Style
|
||||||
Generator</a></li>
|
Generator</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -146,13 +146,13 @@ background like this:</p>
|
|||||||
<style name="CustomActionBarTheme"
|
<style name="CustomActionBarTheme"
|
||||||
parent="@style/Theme.Holo.Light.DarkActionBar">
|
parent="@style/Theme.Holo.Light.DarkActionBar">
|
||||||
<item name="android:actionBarStyle">@style/MyActionBar</item>
|
<item name="android:actionBarStyle">@style/MyActionBar</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar styles -->
|
<!-- ActionBar styles -->
|
||||||
<style name="MyActionBar"
|
<style name="MyActionBar"
|
||||||
parent="@style/Widget.Holo.Light.ActionBar.Solid.Inverse">
|
parent="@style/Widget.Holo.Light.ActionBar.Solid.Inverse">
|
||||||
<item name="android:background">@drawable/actionbar_background</item>
|
<item name="android:background">@drawable/actionbar_background</item>
|
||||||
<style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ background like this:</p>
|
|||||||
|
|
||||||
<!-- Support library compatibility -->
|
<!-- Support library compatibility -->
|
||||||
<item name="actionBarStyle">@style/MyActionBar</item>
|
<item name="actionBarStyle">@style/MyActionBar</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar styles -->
|
<!-- ActionBar styles -->
|
||||||
<style name="MyActionBar"
|
<style name="MyActionBar"
|
||||||
@@ -187,7 +187,7 @@ background like this:</p>
|
|||||||
|
|
||||||
<!-- Support library compatibility -->
|
<!-- Support library compatibility -->
|
||||||
<item name="background">@drawable/actionbar_background</item>
|
<item name="background">@drawable/actionbar_background</item>
|
||||||
<style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -236,25 +236,25 @@ for each text element:</p>
|
|||||||
<item name="android:actionBarStyle">@style/MyActionBar</item>
|
<item name="android:actionBarStyle">@style/MyActionBar</item>
|
||||||
<item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
|
<item name="android:actionBarTabTextStyle">@style/MyActionBarTabText</item>
|
||||||
<item name="android:actionMenuTextColor">@color/actionbar_text</item>
|
<item name="android:actionMenuTextColor">@color/actionbar_text</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar styles -->
|
<!-- ActionBar styles -->
|
||||||
<style name="MyActionBar"
|
<style name="MyActionBar"
|
||||||
parent="@style/Widget.Holo.ActionBar">
|
parent="@style/Widget.Holo.ActionBar">
|
||||||
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
|
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar title text -->
|
<!-- ActionBar title text -->
|
||||||
<style name="MyActionBarTitleText"
|
<style name="MyActionBarTitleText"
|
||||||
parent="@style/TextAppearance.Holo.Widget.ActionBar.Title">
|
parent="@style/TextAppearance.Holo.Widget.ActionBar.Title">
|
||||||
<item name="android:textColor">@color/actionbar_text</item>
|
<item name="android:textColor">@color/actionbar_text</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar tabs text styles -->
|
<!-- ActionBar tabs text styles -->
|
||||||
<style name="MyActionBarTabText"
|
<style name="MyActionBarTabText"
|
||||||
parent="@style/Widget.Holo.ActionBar.TabText">
|
parent="@style/Widget.Holo.ActionBar.TabText">
|
||||||
<item name="android:textColor">@color/actionbar_text</item>
|
<item name="android:textColor">@color/actionbar_text</item>
|
||||||
<style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -280,7 +280,7 @@ for each text element:</p>
|
|||||||
<item name="actionBarStyle">@style/MyActionBar</item>
|
<item name="actionBarStyle">@style/MyActionBar</item>
|
||||||
<item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
|
<item name="actionBarTabTextStyle">@style/MyActionBarTabText</item>
|
||||||
<item name="actionMenuTextColor">@color/actionbar_text</item>
|
<item name="actionMenuTextColor">@color/actionbar_text</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar styles -->
|
<!-- ActionBar styles -->
|
||||||
<style name="MyActionBar"
|
<style name="MyActionBar"
|
||||||
@@ -289,21 +289,21 @@ for each text element:</p>
|
|||||||
|
|
||||||
<!-- Support library compatibility -->
|
<!-- Support library compatibility -->
|
||||||
<item name="titleTextStyle">@style/MyActionBarTitleText</item>
|
<item name="titleTextStyle">@style/MyActionBarTitleText</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar title text -->
|
<!-- ActionBar title text -->
|
||||||
<style name="MyActionBarTitleText"
|
<style name="MyActionBarTitleText"
|
||||||
parent="@style/TextAppearance.<strong>AppCompat</strong>.Widget.ActionBar.Title">
|
parent="@style/TextAppearance.<strong>AppCompat</strong>.Widget.ActionBar.Title">
|
||||||
<item name="android:textColor">@color/actionbar_text</item>
|
<item name="android:textColor">@color/actionbar_text</item>
|
||||||
<!-- The textColor property is backward compatible with the Support Library -->
|
<!-- The textColor property is backward compatible with the Support Library -->
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar tabs text -->
|
<!-- ActionBar tabs text -->
|
||||||
<style name="MyActionBarTabText"
|
<style name="MyActionBarTabText"
|
||||||
parent="@style/Widget.<strong>AppCompat</strong>.ActionBar.TabText">
|
parent="@style/Widget.<strong>AppCompat</strong>.ActionBar.TabText">
|
||||||
<item name="android:textColor">@color/actionbar_text</item>
|
<item name="android:textColor">@color/actionbar_text</item>
|
||||||
<!-- The textColor property is backward compatible with the Support Library -->
|
<!-- The textColor property is backward compatible with the Support Library -->
|
||||||
<style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -392,14 +392,14 @@ for several different states of an action bar tab:</p>
|
|||||||
<style name="CustomActionBarTheme"
|
<style name="CustomActionBarTheme"
|
||||||
parent="@style/Theme.Holo">
|
parent="@style/Theme.Holo">
|
||||||
<item name="android:actionBarTabStyle">@style/MyActionBarTabs</item>
|
<item name="android:actionBarTabStyle">@style/MyActionBarTabs</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar tabs styles -->
|
<!-- ActionBar tabs styles -->
|
||||||
<style name="MyActionBarTabs"
|
<style name="MyActionBarTabs"
|
||||||
parent="@style/Widget.Holo.ActionBar.TabView">
|
parent="@style/Widget.Holo.ActionBar.TabView">
|
||||||
<!-- tab indicator -->
|
<!-- tab indicator -->
|
||||||
<item name="android:background">@drawable/actionbar_tab_indicator</item>
|
<item name="android:background">@drawable/actionbar_tab_indicator</item>
|
||||||
<style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ for several different states of an action bar tab:</p>
|
|||||||
|
|
||||||
<!-- Support library compatibility -->
|
<!-- Support library compatibility -->
|
||||||
<item name="actionBarTabStyle">@style/MyActionBarTabs</item>
|
<item name="actionBarTabStyle">@style/MyActionBarTabs</item>
|
||||||
<style>
|
</style>
|
||||||
|
|
||||||
<!-- ActionBar tabs styles -->
|
<!-- ActionBar tabs styles -->
|
||||||
<style name="MyActionBarTabs"
|
<style name="MyActionBarTabs"
|
||||||
@@ -430,7 +430,7 @@ for several different states of an action bar tab:</p>
|
|||||||
|
|
||||||
<!-- Support library compatibility -->
|
<!-- Support library compatibility -->
|
||||||
<item name="background">@drawable/actionbar_tab_indicator</item>
|
<item name="background">@drawable/actionbar_tab_indicator</item>
|
||||||
<style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@@ -442,7 +442,7 @@ for several different states of an action bar tab:</p>
|
|||||||
href="{@docRoot}guide/topics/ui/themes.html">Styles and Themes</a> guide.</li>
|
href="{@docRoot}guide/topics/ui/themes.html">Styles and Themes</a> guide.</li>
|
||||||
<li>For even more complete styling for the action bar,
|
<li>For even more complete styling for the action bar,
|
||||||
try the <a class="external-link" target="_blank"
|
try the <a class="external-link" target="_blank"
|
||||||
href="www://http.actionbarstylegenerator.com">Android Action Bar Style
|
href="http://www.actionbarstylegenerator.com">Android Action Bar Style
|
||||||
Generator</a>.</li>
|
Generator</a>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -220,7 +220,7 @@ public void onCreate(Bundle savedInstanceState) {
|
|||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p class="caution"><strong>Caution:</strong> Using the {@link android.os.Build.VERSION#SDK_INT} to
|
<p class="caution"><strong>Caution:</strong> Using the {@link android.os.Build.VERSION#SDK_INT} to
|
||||||
prevent older system's from executing new APIs works in this way on Android 2.0 (API level
|
prevent older systems from executing new APIs works in this way on Android 2.0 (API level
|
||||||
5) and higher only. Older versions will encounter a runtime exception.</p>
|
5) and higher only. Older versions will encounter a runtime exception.</p>
|
||||||
|
|
||||||
<p>Once the {@link android.app.Activity#onCreate onCreate()} finishes execution, the system
|
<p>Once the {@link android.app.Activity#onCreate onCreate()} finishes execution, the system
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ next.link=platforms.html
|
|||||||
<ul>
|
<ul>
|
||||||
<li><a href="{@docRoot}training/multiscreen/index.html">Designing for Multiple
|
<li><a href="{@docRoot}training/multiscreen/index.html">Designing for Multiple
|
||||||
Screens</a></li>
|
Screens</a></li>
|
||||||
<li><a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
|
<li><a href="{@docRoot}guide/topics/resources/providing-resources.html">Providing
|
||||||
Screens</a></li>
|
Resources</a></li>
|
||||||
<li><a href="{@docRoot}design/style/iconography.html">Iconography design guide</a></li>
|
<li><a href="{@docRoot}design/style/iconography.html">Iconography design guide</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -66,6 +66,30 @@ include the action bar on devices running Android 2.1 or higher."
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
<li class="nav-section">
|
||||||
|
<div class="nav-section-header">
|
||||||
|
<a href="<?cs var:toroot ?>training/basics/supporting-devices/index.html"
|
||||||
|
description=
|
||||||
|
"How to build your app with alternative resources that provide an
|
||||||
|
optimized user experience on multiple device form factors using a single APK."
|
||||||
|
>Supporting Different Devices</a>
|
||||||
|
</div>
|
||||||
|
<ul>
|
||||||
|
<li><a href="<?cs var:toroot ?>training/basics/supporting-devices/languages.html">
|
||||||
|
Supporting Different Languages
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="<?cs var:toroot ?>training/basics/supporting-devices/screens.html">
|
||||||
|
Supporting Different Screens
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="<?cs var:toroot ?>training/basics/supporting-devices/platforms.html">
|
||||||
|
Supporting Different Platform Versions
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="nav-section">
|
<li class="nav-section">
|
||||||
<div class="nav-section-header">
|
<div class="nav-section-header">
|
||||||
<a href="<?cs var:toroot ?>training/basics/activity-lifecycle/index.html"
|
<a href="<?cs var:toroot ?>training/basics/activity-lifecycle/index.html"
|
||||||
@@ -94,30 +118,6 @@ include the action bar on devices running Android 2.1 or higher."
|
|||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-section">
|
|
||||||
<div class="nav-section-header">
|
|
||||||
<a href="<?cs var:toroot ?>training/basics/supporting-devices/index.html"
|
|
||||||
description=
|
|
||||||
"How to build your app with alternative resources that provide an
|
|
||||||
optimized user experience on multiple device form factors using a single APK."
|
|
||||||
>Supporting Different Devices</a>
|
|
||||||
</div>
|
|
||||||
<ul>
|
|
||||||
<li><a href="<?cs var:toroot ?>training/basics/supporting-devices/languages.html">
|
|
||||||
Supporting Different Languages
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a href="<?cs var:toroot ?>training/basics/supporting-devices/screens.html">
|
|
||||||
Supporting Different Screens
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li><a href="<?cs var:toroot ?>training/basics/supporting-devices/platforms.html">
|
|
||||||
Supporting Different Platform Versions
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="nav-section">
|
<li class="nav-section">
|
||||||
<div class="nav-section-header">
|
<div class="nav-section-header">
|
||||||
<a href="<?cs var:toroot ?>training/basics/fragments/index.html"
|
<a href="<?cs var:toroot ?>training/basics/fragments/index.html"
|
||||||
|
|||||||
Reference in New Issue
Block a user