为什么安卓:actionLayout和android:图标在同一时间? [英] Why have android:actionLayout and android:icon at the same time?
问题描述
我阅读有关忙codeR的Android指导的动作条。有一个例子:
<项目
机器人:ID =@ + ID /加
机器人:actionLayout =@布局/加
机器人:图标=@机器人:可绘制/ ic_menu_add
机器人:showAsAction =ifRoom
机器人:标题=@字符串/添加/>
什么是点同时具有的android:actionLayout
和安卓图标
定义?有什么条件时,图标会显示?
感谢您的帮助了Android的小白
什么条件时,图标会显示?
块引用>我不能排除操作栏将决定没有足够的空间用于
actionLayout
的可能性,但有足够的空间用于操作项,因此这将显示的图标。此外,与ActionBarSherlock,图标显示,即使在Android 2.x设备的溢出,如此反复,如果actionLayout
将过大,可能会被使用的图标。另外,如果我用ifRoom |。collapseActionView
,而不是仅仅ifRoom
,将被使用的图标话虽这么说:
我的例子实际上不留意此理论的行动项目,它应该出现,做任何事情,如果用户点击它
我猜测在可能的行动条的行为,因为我还没有尝试过任何的实验,迫使操作栏,以决定是否有足够的空间为所有的
actionLayout
- 型项目I am reading about action bars in BusyCoder's Android guide. There is an example:
<item android:id="@+id/add" android:actionLayout="@layout/add" android:icon="@android:drawable/ic_menu_add" android:showAsAction="ifRoom" android:title="@string/add"/>
What is the point to have both
android:actionLayout
andandroid:icon
defined? What are the conditions when the icon would show up?Thanks for helping out Android noob
解决方案What are the conditions when the icon would show up?
I can't rule out the possibility that the action bar will decide that there is not enough room for the
actionLayout
, but there is enough room for an action item, which would therefore show the icon. Also, with ActionBarSherlock, the icon is shown even in the overflow on Android 2.x devices, and so again if theactionLayout
would be too large, the icon might get used. Also, if I usedifRoom|collapseActionView
instead of justifRoom
, the icon would be used.That being said:
My sample does not actually watch for this theoretical action item, should it appear, to do anything if the user clicks on it
I am guessing at possible action bar behavior, as I have not tried any experiments to force the action bar to decide whether there is enough room for all
actionLayout
-configured items这篇关于为什么安卓:actionLayout和android:图标在同一时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!