我最近一直在开发一个 Android 应用程序,其中我需要为选项卡栏提供自定义布局和尺寸。到目前为止,我所做的方法是使用 Jake Wharton 的 ActionBarSherlock 库来支持 HoneyComb 之前的 Android 版本,并将样式应用于我编辑 actionBarSize 样式项的应用程序。
现在,我已经在 Galaxy S3(上面装有 Jellybean)上测试了该应用程序,并且标签栏高度不再根据actionBarSize
value.
所以我开始查看 JellyBean 的代码,我在ActionBarPolicy
class:
public int getTabContainerHeight() {
TypedArray a = mContext.obtainStyledAttributes(null, R.styleable.ActionBar,
com.android.internal.R.attr.actionBarStyle, 0);
int height = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
Resources r = mContext.getResources();
if (!hasEmbeddedTabs()) {
// Stacked tabs; limit the height
height = Math.min(height,
r.getDimensionPixelSize(R.dimen.action_bar_stacked_max_height));
}
a.recycle();
return height;
}
从我在此方法中收集到的信息来看,当应用程序处于纵向模式时,JellyBean 似乎通过将选项卡栏高度设置为“action_bar_stacked_max_height”尺寸值(在 4.1 中为 48dp)来限制 TabBar 的高度/values/dimen.xml
文件),即使我已将操作栏高度设置为actionBarSize
.
我尝试通过将其设置为我自己的值来覆盖此尺寸值dimen.xml
文件,但我没有运气。它不起作用。
我的问题:
你们知道我可以覆盖“action_bar_stacked_max_height”尺寸值的方法吗?
先感谢您!