android - How to hide tab side line? -
my design below:
home | android | java
how hide tab side line? code below:
public class mainactivity extends fragmentactivity implements actionbar.tablistener { private viewpager viewpager; private tabspageradapter madapter; private actionbar actionbar; // tab titles private string[] tabs = { "home", "android", "java" }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // initilization viewpager = (viewpager) findviewbyid(r.id.pager); actionbar = getactionbar(); madapter = new tabspageradapter(getsupportfragmentmanager()); viewpager.setadapter(madapter); //actionbar.sethomebuttonenabled(false); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); // getactionbar().setdisplayuselogoenabled(false); getactionbar().setdisplayshowhomeenabled(false); // adding tabs (string tab_name : tabs) { actionbar.addtab(actionbar.newtab().settext(tab_name) .settablistener(this)); } /** * on swiping viewpager make respective tab selected * */ viewpager.setonpagechangelistener(new viewpager.onpagechangelistener() { @override public void onpageselected(int position) { // on changing page // make respected tab selected actionbar.setselectednavigationitem(position); } @override public void onpagescrolled(int arg0, float arg1, int arg2) { } @override public void onpagescrollstatechanged(int arg0) { } }); } @override public void ontabreselected(tab tab, fragmenttransaction ft) { } @override public void ontabselected(tab tab, fragmenttransaction ft) { // on tab selected // show respected fragment view viewpager.setcurrentitem(tab.getposition()); } @override public void ontabunselected(tab tab, fragmenttransaction ft) { }
}
here style.xml file. where, need change code hide tab side line
<resources xmlns:android="http://schemas.android.com/apk/res/android"> <!-- base application theme, dependent on api level. theme replaced appbasetheme res/values-vxx/styles.xml on newer devices. --> <style name="appbasetheme" parent="android:theme.light"> <!-- theme customizations available in newer api levels can go in res/values-vxx/styles.xml, while customizations related backward-compatibility can go here. --> </style> <!-- application theme. --> <style name="apptheme" parent="appbasetheme"> <item name="android:actionbarstyle">@style/myactionbartheme</item> <item name="android:actionbartabtextstyle">@style/actionbartabtext</item> <item name="android:titletextstyle">@style/myactionbartitletext</item> <item name="android:actionbartabstyle">@style/tabstyle</item> <!-- customizations not specific particular api-level can go here. --> </style> <style name="myactionbartheme" parent="@android:style/widget.holo.light.actionbar"> <item name="android:background">#029c7a</item> </style> <style name="actionbartabtext" parent="@android:style/widget.holo.light.actionbar"> <item name="android:textcolor">#fff</item> <item name="android:gravity">center</item> </style>
#ffffff
<item name="android:background">#029c7a</item> </style>
my tabpageadapter ,how hide tab side line please 1 helpme
public class tabspageradapter extends fragmentpageradapter { public tabspageradapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int index) { switch (index) { case 0: // top rated fragment activity return new kids(); case 1: // games fragment activity return new kids(); case 2: // movies fragment activity return new kids(); } return null; } @override public int getcount() { // item count - equal number of tabs return 3; }
}
if want rid of dividers,use code:
<style name="customtabbar" parent="@android:style/widget.holo.actionbar.tabbar"> <item name="android:divider">@null</item> </style>
Comments
Post a Comment