android - ActionBar overflowing on pre-ICS devices -


i'm developing application needs compatible android 2.2+ it's using actionbarsherlock customize actionbar on pre-ics devices.

i'm facing problem on 2.2 , 2.3 devices makes content of actionbar overflow though content fits device screen. this:

enter image description here

i've tested (on emulator) device screen size (mdpi on 320x480) runnning android 4.0 , works fine, believe problem related actionbarsherlock.

i'm tried drastically reducing icon files, though images smaller, content still overflowing.

here styles.xml file:

<style name="appbasetheme" parent="theme.sherlock.light.darkactionbar"> </style>  <style name="apptheme" parent="appbasetheme">     <item name="actionbarstyle">@style/appbasetheme.actionbarstyle</item>     <item name="actionbartabstyle">@style/appbasetheme.actionbartabstyle</item>     <item name="actionbartabbarstyle">@style/appbasetheme.actionbartabbarstyle</item> </style>  <style name="appbasetheme.actionbarstyle" parent="widget.sherlock.light.actionbar.solid.inverse">     <item name="background">@drawable/action_bar_background</item>     <item name="android:background">@drawable/action_bar_background</item> </style>  <style name="appbasetheme.actionbartabstyle" parent="widget.sherlock.light.actionbar.tabview.inverse">     <item name="background">@android:color/transparent</item>     <item name="android:background">@android:color/transparent</item>      <item name="android:paddingleft">0dip</item>     <item name="android:paddingright">0dip</item> </style>  <style name="appbasetheme.actionbartabbarstyle" parent="widget.sherlock.light.actionbar.tabbar.inverse">     <item name="background">@drawable/action_bar_tab_divider</item>     <item name="android:background">@drawable/action_bar_tab_divider</item>      <item name="divider">@drawable/sp</item>     <item name="android:divider">@drawable/sp</item> </style> 

the file @drawable/action_bar_background 320px wide , both @drawable/action_bar_tab_divider , @drawable/sp 1px wide.

and here code creating tabs on main activity:

actionbar actionbar = super.getsupportactionbar(); actionbar.setnavigationmode(actionbar.navigation_mode_tabs);  this.createtab(actionbar, r.drawable.action_bar_tab_home_off); this.createtab(actionbar, r.drawable.action_bar_tab_news_off); this.createtab(actionbar, r.drawable.action_bar_tab_videos_off); this.createtab(actionbar, r.drawable.action_bar_tab_guide_off);   private void createtab(actionbar actionbar, int resource) {     tab t = actionbar.newtab();      t.settablistener(this);     t.seticon(resource);      actionbar.addtab(t); } 

any ideas?

one of problems action view "tab bar" automatically scales images predetermined size, if make icon super large or super small should fill same space in action bar.

the tabbar/tabview designed overflow, have found ^.^ it's apps open 10 20 different tabs @ time, user can scroll through list of them. not tab view difficult work using fixed, non scrolling list of icons, because android devices come in shapes , sizes.

two options might suite looking for. create own relativelayout or linearlayout icons inside of layout. way choose size of action bar every time =) can have bar dock either on top or bottom of activity.

if isn't option may able add icons onto top actionbar menu doesn't scrolling. icons might not fit on main actionbar cause overflowing icons placed overflow menu dropdown. =(

to remove divider spacing between tabs save following code new xml file in drawable folder such dividerdrawable.xml:

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"     android:shape="line" >     <size         android:width="0px"         android:color="@android:color/black"         android:dashwidth="0px"         android:dashgap="0px" /> </shape> 

and use drawable tab divider.

<item name="divider">@drawable/dividerdrawable</item> 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -