Android (ActionBarSherlock) Is there any way to keep the same ActionBar height both in portrait and landscape? -
i have been working actionbar , actionbarsherlock last few days, , having issues when filling information in actionbar.
when application runs in portrait mode, actionbar looks fine, , data can displayed, example:

but when switch app displayed in landscape, of data cropped:

you can notice how both status icon , email has been cropped due new height of actionbar.
in case, want keep same size portrait , landscape app can fine. can't reduce font size of action bar title, since may include other icons.
the way i´m putting these icons in action bar title , subtitle using html.fromhtml
any ideas solve problem? using actionbarsherlock library!
one, not pretty approach, override default height values actionbar in dimens.xml.
e.g. default value in portrait is:
<dimen name="abs__action_bar_default_height">48dip</dimen> and in landscape:
<dimen name="abs__action_bar_default_height">40dip</dimen> there might cleaner way it, have admit know little internals of actionbarsherlock that.
edit: come think of it, won't work when native actionbar being used on ics, since height resolve platform value in ?android:attr/actionbarsize. i'd recommend wait better suggestion, e.g. jake himself.
second edit: after jake's reply seems need make work actionbarsherlock on both ics , pre-ics devices add following app's theme:
<item name="actionbarsize">@dimen/some_value</item> <item name="android:actionbarsize">@dimen/some_value</item> you can add actual values in relevant portrait/land resource buckets.
third edit [thanks alvarolb]: xml example style:
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="theme.styled" parent="theme.sherlock.light.darkactionbar"> <item name="actionbarsize">48dip</item> <item name="android:actionbarsize">48dip</item> </style> </resources> and in corresponding activity, set new style
android:theme="@style/theme.styled" and.. works!
Comments
Post a Comment