0
나는 FragmentTabHost
을 만들었습니다 .i는 FragmentTabHost
에서 배경색을 변경하고 일부 색상을 바꿀 수 있습니다. 예를 들어 배경색을 검정색과 텍스트 색으로 지정하고 싶습니다. white.this는 내 xml
코드 android change FragmentTabHost 배경색 및 텍스트 색상
<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ff0000"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
이며, 이것은 내 자바 코드
public class CustomTabActivity extends FragmentActivity {
private FragmentTabHost mTabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
mTabHost.setup(this, getSupportFragmentManager(), android.R.id.tabcontent);
mTabHost.addTab(
mTabHost.newTabSpec("tab1").setIndicator("Tab 1", null),
StradaMenu.class, null);
mTabHost.addTab(
mTabHost.newTabSpec("tab2").setIndicator("Tab 2", null),
StradaMenu.class, null);
mTabHost.addTab(
mTabHost.newTabSpec("tab3").setIndicator("Tab 3", null),
StradaMenu.class, null);
}
}
,369입니다
어떻게 문제를 해결할 수 있습니까? 아무도 해결책을 안다면 도와주세요 감사합니다
? 또는 각 탭의 다른 색상? – Steve
각 탭마다 다른 색상을 변경하고 싶습니다. – baggio