首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android 如何设置TabHost默认显示的选项卡为选中状态

2012-10-18 
android 怎么设置TabHost默认显示的选项卡为选中状态这个问题让我纠结很久了,没办法,只好请教高人了!如图,

android 怎么设置TabHost默认显示的选项卡为选中状态
这个问题让我纠结很久了,没办法,只好请教高人了!
如图,当程序进入的时候显示如下界面

显示的为我标识的选项卡,但是他们并没有被选中,我想让他们默认为选中状态,如下图

实在没找到用什么方法,请教下各位,谢了!

[解决办法]
tabhost.getCurrentTabView().setBackgroundColor(Color.CYAN); //设置默认选中状态的背景

Java code
 tabhost.setOnTabChangedListener(new OnTabChangeListener() {                          @Override                             public void onTabChanged(String tabId) {                     for(int i = 0; i < tabWidge.getChildCount(); i++) {                                         View tabView = tabWidge.getChildAt(i);                                    if(tabhost.getCurrentTab() == i) {                                          tabView.setBackgroundColor(Color.CYAN);                                     } else {                                                               tabView.setBackgroundColo(Color.BLACK));     //未选中的颜色                                    }                                        }                            }                  });
[解决办法]
你这 ,也不说清楚,Tabhost还掺和了RadioButton对象
[解决办法]
介意LZ不要再使用TabHost,这个在工作中是不用的

热点排行