Skip to content

Commit 328ee95

Browse files
scottamainAndroid (Google) Code Review
authored andcommitted
Merge "docs: add new action item and state list drawable resource attributes"
2 parents b23e99c + feef62b commit 328ee95

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

docs/html/guide/topics/resources/drawable-resource.jd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ In XML: <code>@[<em>package</em>:]drawable/<em>filename</em></code>
641641
android:drawable="@[package:]drawable/<em>drawable_resource</em>"
642642
android:state_pressed=["true" | "false"]
643643
android:state_focused=["true" | "false"]
644+
android:state_hovered=["true" | "false"]
644645
android:state_selected=["true" | "false"]
645646
android:state_checkable=["true" | "false"]
646647
android:state_checked=["true" | "false"]
@@ -692,6 +693,11 @@ is touched/clicked); "false" if this item should be used in the default, non-pre
692693
<dd><em>Boolean</em>. "true" if this item should be used when the object is focused (such as when a button
693694
is highlighted using the trackball/d-pad); "false" if this item should be used in the default,
694695
non-focused state.</dd>
696+
<dt><code>android:state_hovered</code></dt>
697+
<dd><em>Boolean</em>. "true" if this item should be used when the object is being hovered
698+
by a cursor; "false" if this item should be used in the default, non-hovered state. Often, this
699+
drawable may be the same drawable used for the "focused" state.
700+
<p>Introduced in API level 14.</p></dd>
695701
<dt><code>android:state_selected</code></dt>
696702
<dd><em>Boolean</em>. "true" if this item should be used when the object is selected (such as when a
697703
tab is opened); "false" if this item should be used when the object is not selected.</dd>
@@ -729,6 +735,8 @@ default value should always be last (as demonstrated in the following example).<
729735
android:drawable="@drawable/button_pressed" /> &lt;!-- pressed --&gt;
730736
&lt;item android:state_focused="true"
731737
android:drawable="@drawable/button_focused" /> &lt;!-- focused --&gt;
738+
&lt;item android:state_hovered="true"
739+
android:drawable="@drawable/button_focused" /> &lt;!-- hovered --&gt;
732740
&lt;item android:drawable="@drawable/button_normal" /> &lt;!-- default --&gt;
733741
&lt;/selector>
734742
</pre>

docs/html/guide/topics/resources/menu-resource.jd

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ In XML: <code>@[<em>package</em>:]menu.<em>filename</em></code>
4343
android:titleCondensed="<em>string</em>"
4444
android:icon="@[package:]drawable/<em>drawable_resource_name</em>"
4545
android:onClick="<em>method name</em>"
46-
android:showAsAction=["ifRoom" | "never" | "withText" | "always"]
46+
android:showAsAction=["ifRoom" | "never" | "withText" | "always" | "collapseActionView"]
4747
android:actionLayout="@[package:]layout/<em>layout_resource_name</em>"
4848
android:actionViewClass="<em>class name</em>"
49+
android:actionProviderClass="<em>class name</em>"
4950
android:alphabeticShortcut="<em>string</em>"
5051
android:numericShortcut="<em>string</em>"
5152
android:checkable=["true" | "false"]
@@ -131,6 +132,9 @@ of the others as a flag set, by separating them with a pipe {@code |}.</td></tr>
131132
Avoid using this unless it's critical that the item always appear in the action
132133
bar. Setting multiple items to always appear as action items can result in them overlapping
133134
with other UI in the action bar.</td></tr>
135+
<tr><td><code>collapseActionView</code></td><td>The action view associated
136+
with this action item (as declared by <code>android:actionViewLayout</code>) is
137+
collapsible.<br/>Introduced in API Level 14.</td></tr>
134138
</table>
135139
<p>See the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer
136140
guide for more information.</p>
@@ -143,9 +147,10 @@ guide for more information.</p>
143147
guide for more information.</p>
144148
<p>Introduced in API Level 11.</p></dd>
145149

146-
<dt><code>android:actionViewClassName</code></dt>
150+
<dt><code>android:actionViewClass</code></dt>
147151
<dd><em>Class name</em>. A fully-qualified class name for the {@link android.view.View}
148-
to use as the action view.
152+
to use as the action view. For example,
153+
{@code "android.widget.SearchView"} to use {@link android.widget.SearchView} as an action view.
149154
<p>See the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer
150155
guide for more information.</p>
151156
<p class="warning"><strong>Warning:</strong> If you obfuscate your code using <a
@@ -154,6 +159,17 @@ be sure to exclude the class you specify in this attribute from renaming, becaus
154159
functionality.</p>
155160
<p>Introduced in API Level 11.</p></dd>
156161

162+
<dt><code>android:actionProviderClass</code></dt>
163+
<dd><em>Class name</em>. A fully-qualified class name for the {@link
164+
android.view.ActionProvider} to use in place of the action item. For example,
165+
{@code "android.widget.ShareActionProvider"} to use {@link android.widget.ShareActionProvider}.
166+
<p>See the <a href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a> developer
167+
guide for more information.</p>
168+
<p class="warning"><strong>Warning:</strong> If you obfuscate your code using <a
169+
href="{@docRoot}guide/developing/tools/proguard.html">ProGuard</a> (or a similar tool),
170+
be sure to exclude the class you specify in this attribute from renaming, because it can break the
171+
functionality.</p>
172+
<p>Introduced in API Level 14.</p></dd>
157173

158174
<dt><code>android:alphabeticShortcut</code></dt>
159175
<dd><em>Char</em>. A character for the alphabetic shortcut key.</dd>

0 commit comments

Comments
 (0)