如果您添加标签到你的动作条
,他们将在动作条
堆积额外的电话在纵向模式。有没有一种简单的方法,以找出是否会发生?
If you add tabs to your ActionBar
, they will be in an extra stacked ActionBar
on phones in portrait mode. Is there an easy way to find out whether this happened?
我已经把它贴在YouTube应用程序的两个截图。第一个显示正常动作条
在它的选项卡,第二个显示在标签堆叠动作条
。
I've attached two screenshots of the YouTube app. The first one shows the normal ActionBar
with the tabs in it, the second one shows the tabs in a stacked ActionBar
.
有可能找出是否存在由IS的身高在操作栏中一行或两行。有法 的getHeight()
,但它不会在正常工作的onCreate
或 ONSTART
,它将返回只有当活动已经开始了真正的价值。
It is possible to find out if there is one or two lines in action bar by is's height. There is method getHeight()
, but it will not work in onCreate
or onStart
, it will return real value only if activity already started.
在动作条横向高度 40dip
(80/60/40/30 PX在不同的屏幕),在纵向的标签是96dp(192 / 144/96/72像素)。
In landscape orientation height of action bar is 40dip
(80/60/40/30 px on different screens), in portrait orientation with tabs it is 96dp (192/144/96/72 px).
这不是靠这个最好的主意,但我找不到任何其他的方式,以找出是否卡在里面行动吧。
It is not the best idea to rely on this, but I can't find any other way to find out if tabs is inside action bar.