android - how to change width of custom tab? -


i trying custom tabs in action bar. works fine in many devices width not set match_parent. have used textview custom layout. tried many things changed in style.xml

<style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="android:padding">0dp</item> </style>

but upper solution other layout become stucked up. if know how enlarge size of custom tab match_parent me thank you

this how looks.

==> code try set textview tabs

   textview textview=new textview(getapplicationcontext());             textview.settext(tab_name);             textview.setgravity(gravity.center);             textview.settextsize(20.0f);               textview.setlayoutparams(new viewgroup.layoutparams(viewgroup.layoutparams.match_parent, viewgroup.layoutparams.match_parent));             textview.setpadding(20,0,20,0);             textview.setbackgroundcolor(color.parsecolor("#ffffff"));             textview.settextcolor(color.parsecolor("#000000"));             textview.settypeface(customfont);               actionbar.addtab(actionbar.newtab().settext(tab_name).setcustomview(textview)                 .settablistener(this));  

atlast got solution this..

<style name="apptheme" parent="theme.appcompat.light.darkactionbar">         <!-- customize theme here. -->     </style> 

this app theme @ first changed :

<style name="apptheme" parent="theme.appcompat.light">             <!-- customize theme here. -->         </style> 

and included other style actionbar

 <style name="custom_theme" parent="theme.appcompat.light.darkactionbar">       <item name="android:padding">0dp</item>       </style> 

and set action bar activity theme custom theme. whole app theme apptheme perticular activity set custom_theme.

 <activity android:name=".abc" android:theme="@style/custom_theme" android:launchmode="singletask"             android:screenorientation="portrait"             > 

i tried many ways none work. implement way.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -