作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Android 2.2 即 API 级别 8 为 TabWidget 设置了 tabStripEnabled="true"如何在旧版本的 Android 中实现相同的目标?
最佳答案
private void SetupTabs(TabHost tabHost) {
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0);
TabWidget tw = (TabWidget) ll.getChildAt(0);
Field mBottomLeftStrip;
Field mBottomRightStrip;
try {
mBottomLeftStrip = tw.getClass().getDeclaredField("mBottomLeftStrip");
mBottomRightStrip = tw.getClass().getDeclaredField("mBottomRightStrip");
if (!mBottomLeftStrip.isAccessible()) {
mBottomLeftStrip.setAccessible(true);
}
if (!mBottomRightStrip.isAccessible()) {
mBottomRightStrip.setAccessible(true);
}
mBottomLeftStrip.set(tw, getResources().getDrawable(R.drawable.blank));
mBottomRightStrip.set(tw, getResources().getDrawable(R.drawable.blank));// blank is the name of the image in drawable folder
}
catch (java.lang.NoSuchFieldException e) {
// possibly 2.2
try {
Method stripEnabled = tw.getClass().getDeclaredMethod("setStripEnabled", boolean.class);
stripEnabled.invoke(tw, false);
}
catch (Exception e1) {
e1.printStackTrace();
}
}
catch (Exception e) {}
}
关于android - 旧 API 中 TabWidget 的 tabStripEnabled,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4941522/
我正在使用 tabhost 并试图禁用标签边框线。我用过这个 android:tabStripEnabled="false"在我的 XML 中,但它似乎不起作用,该行仍然存在,我尝试其他方式,例如更改
Android 2.2 即 API 级别 8 为 TabWidget 设置了 tabStripEnabled="true"如何在旧版本的 Android 中实现相同的目标? 最佳答案 private
Android 2.2 即 API 级别 8 为 TabWidget 设置了 tabStripEnabled="true"如何在旧版本的 Android 中实现相同的目标? 最佳答案 private
我是一名优秀的程序员,十分优秀!