我添加标签来我这个代码的应用程序: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