I am adding tabs to my app with this code:
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);
And this is the 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>
I want to change tab background,but result:
How can I fix it ? Customview is not centering.
0 comments:
Post a Comment