I have been working with the ActionBar and ActionBarSherlock for the last few days, and i am having some issues when filling some information in the ActionBar.
When the application runs in portrait mode, the ActionBar looks fine, and all the data can be displayed, for example:
But when i switch the app to be displayed in landscape, some of the data is cropped:
You can notice how both the status icon and the email has been cropped due to the new height of the ActionBar.
In this case, i want to keep the same size for portrait and landscape so the app can look fine. I can't reduce the font size of the action bar title, since it may include other icons.
The way i´m putting these icons in the action bar title and subtitle is by using Html.fromHtml
Any ideas to solve this problem? I am using the ActionBarSherlock library!
One, probably not too pretty approach, could be to override the default height values for the ActionBar indimens.xml
.E.g. the default value in portrait is:
And in landscape:
There might be a cleaner way to do it, but I have to admit I know too little about the internals of ActionBarSherlock for that.
Edit: Come to think of it, this probably won't work when the native ActionBar is being used on ICS, since the height will then resolve to the platform value in
?android:attr/actionBarSize
. I'd recommend you wait for a better suggestion, e.g. from Jake himself.Second edit: After Jake's reply it seems like all you need to do to make it work with ActionBarSherlock on both ICS and pre-ICS devices is add the following to your app's theme:
You can then add the actual values in the relevant portrait/land resource buckets.
Third edit [thanks alvarolb]: XML Example for the style:
And in the corresponding activity, set this new style
and.. it works!