android 怎么设置TabHost默认显示的选项卡为选中状态
2017-09-16
展开全部
给TAB卡做个布局,在布局里面把TextView设置成居中
给个事例给你看下
TabHost.TabSpec localTabSpec1 = this.tabHost.newTabSpec("1");
//R.Layout.tab_indicator 就是TAB选项卡的布局
View localView = getLayoutInflater().inflate(R.layout.tab_indicator, null);
ImageView localImageView = (ImageView) localView.findViewById(R.id.icon);
localImageView.setImageResource(R.drawable.menu_ranking);
TabHost.TabSpec localTabSpec2 = localTabSpec1.setIndicator(localView);
Intent localIntent = new Intent(this, RankActivity.class);
localTabSpec2.setContent(localIntent);
this.tabHost.addTab(localTabSpec1);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询