I have Set the tabview in My Application But all tab shows very near to eachother. . i want to Set the Little Space between then. . . How it is Possible ? Thanks in Advance.
            Asked
            
        
        
            Active
            
        
            Viewed 240 times
        
    3 Answers
0
            
            
        You can add space in the tabview item by giving a margin inside that. Use the code below.
for(int i=0; i < mTabLayout.getTabCount(); i++) {  
     View tab = ((ViewGroup) mTabLayout.getChildAt(0)).getChildAt(i); 
     ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) 
     tab.getLayoutParams(); > p.setMargins(0, 0, 50, 0); > tab.requestLayout();
}
        rghome
        
- 8,529
 - 8
 - 43
 - 62
 
        Kanhaiya Chaurasiya
        
- 37
 - 7
 
0
            
<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">
    <LinearLayout android:orientation="vertical"
        android:layout_width="fill_parent" android:layout_height="fill_parent">
        <View android:layout_width="fill_parent" android:layout_height="0.5dip"
Here, I set 0.5 you can st 1 dp and you can set a tabdiver.9.png file.
            android:background="#000" />
        <TabWidget android:id="@android:id/tabs"
            android:layout_width="fill_parent" android:layout_height="55dip"
            android:layout_marginLeft="0dip" android:layout_marginRight="0dip" />
        <View android:layout_width="fill_parent" android:layout_height="5dip"
            android:background="#696969" />
        <View android:layout_width="fill_parent" android:layout_height="1dip" 
            android:background="#000" />
        <FrameLayout android:id="@android:id/tabcontent"
            android:layout_width="fill_parent" android:layout_height="fill_parent" />
    </LinearLayout>
</TabHost>
Try this.