我添加標籤來我這個代碼的應用程序:Android的標籤定製查看
ActionBar.Tab tab1=actionBar.newTab();
tab1.setTabListener(this);
tab1.setCustomView(R.layout.tab_style);
TextView txt1 = (TextView)tab1.getCustomView().findViewById(R.id.tabtext);
txt1.setText(R.string.tab_1);
actionBar.addTab(tab1);
這是tab_style.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- This is the main layout of the application -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_basic_root"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/white"
android:paddingBottom="15dp"
>
<TextView
android:id="@+id/tabtext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:minHeight="?android:attr/listPreferredItemHeight"
android:textSize="20dp"
/>
</RelativeLayout>
我想改變標籤的背景,但結果是:
我怎樣才能解決這個問題? Customview不居中。
將'android:paddingBottom =「0dip」'添加到relativelayout中 – mmlooloo 2014-09-27 15:36:22
不起作用。同樣的 – 2014-09-27 17:18:25