TabHost每个选项卡的字体颜色怎么修改? 本帖最后由 wangjun8868 于 2012-12-22 17:49:21 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这里有一个简单的项目 里面有修改tab字体颜色的AndroidMusicPlayer indicator.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/indicator_bg" android:gravity="center" > <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="8dp" android:gravity="center" android:textAppearance="@android:style/TextAppearance.Medium" android:textColor="#FFFFE7" /></LinearLayout>music_explorer.xml<?xml version="1.0" encoding="utf-8"?><TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="0.0dip" android:layout_weight="1.0" /> </LinearLayout></TabHost>activity@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.music_explorer); li=getLayoutInflater(); initTabs(); } private void initTabs(){ TabHost th=getTabHost(); th.setOnTabChangedListener(this); TabSpec ts = null; int count = 4; if(artist_key.length()>0){ count = 2; } for(int i=0;i<count;i++){ ts=th.newTabSpec(tags[i]); View view=li.inflate(R.layout.indicator, null); TextView tv=(TextView) view.findViewById(R.id.textView); tv.setText(getString(tabsResources[i])); ts.setIndicator(view); ts.setContent(this); th.addTab(ts); } } for(int i = 0; i < tabWidge.getChildCount(); i++) { final TextView tv = (TextView) tabWidge.getChildAt(i).findViewById(android.R.id.title); tv.setTextColor(Color.WHITE); tv.setTextSize(18); } 怎样在Android平台实现:从服务器读取一批图片,再滚动显示出来 Android调用Web页面,实现手机客户端图片上传及定位 android USB通信 (结贴率100%)xml解析。。。。根据下面要求把下面的xml文件解析了。。。 android EditText与ListView 关于焦点获取的问题 ListView中的TextView全部走马灯效果 SQLite怎么加用户名密码呢? tablelayout高度问题 请教修改Launcher.apk的小问题 android 真机数据库出错? 求大神指导,新手写程序出现数据存取方面的错误,不知如何解决,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/indicator_bg"
android:gravity="center" > <TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center"
android:textAppearance="@android:style/TextAppearance.Medium"
android:textColor="#FFFFE7" /></LinearLayout>music_explorer.xml<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" > <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" > <TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" /> <FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0.0dip"
android:layout_weight="1.0" />
</LinearLayout></TabHost>activity@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.music_explorer);
li=getLayoutInflater();
initTabs();
}
private void initTabs(){
TabHost th=getTabHost();
th.setOnTabChangedListener(this);
TabSpec ts = null;
int count = 4;
if(artist_key.length()>0){
count = 2;
}
for(int i=0;i<count;i++){
ts=th.newTabSpec(tags[i]);
View view=li.inflate(R.layout.indicator, null);
TextView tv=(TextView) view.findViewById(R.id.textView);
tv.setText(getString(tabsResources[i]));
ts.setIndicator(view);
ts.setContent(this);
th.addTab(ts);
}
}
for(int i = 0; i < tabWidge.getChildCount(); i++) { final TextView tv = (TextView) tabWidge.getChildAt(i).findViewById(android.R.id.title);
tv.setTextColor(Color.WHITE);
tv.setTextSize(18); }