Android的TabWidget在光的主题 [英] Android TabWidget in Light theme

查看:211
本文介绍了Android的TabWidget在光的主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个目标的1.5框架,并使用默认光主题的应用程序。当使用标签插件与此主题,标签图像是勉强可见,而标签字幕是完全不可能辨别,除了当前激活的标签

I have an application that targets the 1.5 framework and uses the default light theme. When using a tab widget with this theme, the tab images are barely visible, and the tab captions are quite impossible to discern, except for the currently active tab.

在默认黑暗的主题,这些标签都经过相当清楚,但是这不是一个解决方案,我会非常高兴。有一个简单的设置,我可以设置,该设置的标签窗口小部件在光的主题更好的可见性,否则我将不得不篡改手动图像和文本样式?

In the default dark theme these tabs come through quite clearly, but this is not a solution I'd be very happy with. Is there a simple setting I can set, that sets up the tab widget for better visibility in light themes, or would I have to tamper with images and text styles manually?

推荐答案

这不是pretty的,但你可以在你的选项卡的活动试试这个。

it's not pretty, but you can try this in your tab activity.

// light theme support
final TabHost tabHost = getTabHost();
tabHost.setBackgroundColor(Color.WHITE);
tabHost.getTabWidget().setBackgroundColor(Color.BLACK);

// hack to set font size
LinearLayout ll = (LinearLayout) tabHost.getChildAt(0);
TabWidget tw = (TabWidget) ll.getChildAt(0);

// first tab
RelativeLayout rllf = (RelativeLayout) tw.getChildAt(0);
lf = (TextView) rllf.getChildAt(1);
lf.setTextSize(21);
lf.setPadding(0, 0, 0, 6);

// second tab
RelativeLayout rlrf = (RelativeLayout) tw.getChildAt(1);
rf = (TextView) rlrf.getChildAt(1);
rf.setTextSize(21);
rf.setPadding(0, 0, 0, 6);

/res/values​​/colors.xml应该有

/res/values/colors.xml should have

<resources>
    <drawable name="black">#ff000000</drawable>
    <drawable name="white">#ffffffff</drawable>
</resources>

AndroidManiest.xml应该有

AndroidManiest.xml should have

<application android:theme="@android:style/Theme.Light">

如果你想要做的事疯狂,尝试<一href="http://ezmobile.word$p$pss.com/2009/02/02/customized-android-tabs/">http://ezmobile.word$p$pss.com/2009/02/02/customized-android-tabs/

if you want to do something crazier, try http://ezmobile.wordpress.com/2009/02/02/customized-android-tabs/

这篇关于Android的TabWidget在光的主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆