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

作者&投稿:登贪 (若有异议请与网页底部的电邮联系)
android 如何设置TabHost默认显示的选项卡为选中状态~

tabHost.setCurrentTab(1);

我试过下面的方法,都不行啊 ~~ 郁闷 : localTabHost.clearFocus(); localTabHost.findViewById(R.id.tab_host_tittle_phone).findFocus(); localTabHost.setCurrentTab(0); 现在的问题是,这个TabHost的实际选项卡是在第一个,但是按钮的背景却显示到了最后面一个~我试过修改按钮的加载次序,但是没有效果~~

给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);


邛崃市19319057712: TabHost如何自定义Tab高度及tab中文字的大小及位置? -
稻钥莱普: int count = tabWidget.getChildCount();//TabHost中有一个getTabWidget()的方法 for (int i = 0; i

邛崃市19319057712: TabHost如何自定义Tab高度及tab中文字的大小及位置?
稻钥莱普: int count = tabWidget.getChildCount();//TabHost中有一个getTabWidget()的方法 for (int i = 0; i < count; i++) { View view = tabWidget.getChildTabViewAt(i); view.getLayoutParams().height = 80; //tabWidget.getChildAt(i) final TextView tv = (...

邛崃市19319057712: android 怎么设置TabHost默认显示的选项卡为选中状态 -
稻钥莱普: int currentTab = tabhost.getCurrentTab(); if(currentTab == 默认选项卡){//设置背景颜色区别其他tab的颜色就搞定}

邛崃市19319057712: Android里怎么将Tabhost放在屏幕底部?
稻钥莱普: android:layout_height=“1”

邛崃市19319057712: Android Studio怎么设置Tab键为4行缩进 -
稻钥莱普: 在 工具 菜单中,选择 选项. 在 文本编辑器 文件夹,选择. 所有语言 子文件夹的 常规 选项全局设置此选项.—或 —选择子文件夹中的 常规 可供使用的编程语言的.在 设置下,选择或清除 自动换行 选项.当 自动换行 选项时, 显示可视的自动换行标志符号 启用选项.选择,如果您希望显示一个回车箭头指示符在第二行的较长的行换行的 显示可视的自动换行标志符号 选项. ,如果您不想显示指示箭头,请清除此选项.

邛崃市19319057712: 怎么在安卓手机输入法上打tab键,或者有什么安卓版的电脑输入法可以用,,谢谢了 -
稻钥莱普: 建议在你的安卓机上装搜狗输入法

邛崃市19319057712: 如何改变Android tab 的高度和字体大小 -
稻钥莱普: 可以通过一下代码实现改变Android tab 的高度和字体大小:nt count = tabWidget.getChildCount(); for (int i = 0; iView view = tabWidget.getChildTabViewAt(i);view.getLayoutParams().height = 80; //tabWidget.getChildAt(i) final TextView tv = (...

邛崃市19319057712: android 如何设置TabHost默认显示的选项卡为选中状态 -
稻钥莱普: tabHost.setCurrentTab(1);

邛崃市19319057712: 如何自定义android Button样式 -
稻钥莱普: Button样式 也就是button在页面上显示的外观,说白点,就是给他加个背景,比如:你写个xml文件(用shape写个椭圆),里面定义的是个椭圆,颜色自己定,然后通过android:background="@drawable/XXXX" /> (xxxx就是你用xml写的椭圆).设置上去后,在页面上这个按钮就是椭圆的了.

邛崃市19319057712: android studio怎么新建tabhost -
稻钥莱普: 具体如下:以下通过TabHost实现android选项卡.main.xml布局文件: android:layout_width="fill_parent" android:layout_height="fill_parent">android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网