我想更改我在我的 android 应用程序中创建的选项卡中的字体。
这是我的 xml 文件:
<com.markupartist.android.widget.ActionBar
android:id="@+id/actionbar"
style="@style/ActionBar" />
<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"
android:background="@android:color/white" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="fill_vertical"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray"
android:orientation="horizontal"
android:paddingTop="0dp"
android:tabStripEnabled="true" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
</LinearLayout>
</TabHost>
这是我的活动:
公共类 Home_Activity 扩展 TabActivity {
private static final int DIALOG_REALLY_EXIT_ID = 0;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
final ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar);
actionBar.setTitle(getString(R.string.app_name));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, "I've Been Using");
intent.putExtra(Intent.EXTRA_TEXT, "BikeDSS Application by: Chocholuis");
final Action shareAction = new IntentAction(this, Intent.createChooser(
intent, "Share BikeDSS"), R.drawable.icon_share);
actionBar.addAction(shareAction);
Action searchAction = new IntentAction(this, new Intent(this,
search_activity.class), R.drawable.icon_search);
actionBar.addAction(searchAction);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tab
// Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, Tab_Bike_Activity.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("bike")
.setIndicator("Bike", res.getDrawable(R.drawable.sepeda))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, Tab_Brand_ListView_Activity.class);
spec = tabHost.newTabSpec("information")
.setIndicator("Information", res.getDrawable(R.drawable.info))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this,
Tab_Shop_Repair_ListView_Activity.class);
spec = tabHost
.newTabSpec("repair")
.setIndicator("Shop and Bicycle Repair",
res.getDrawable(R.drawable.bengkel)).setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
我可以改变字体吗?我真的需要帮助。谢谢