Sorry if I am just being a noob here, but I cannot figure out how to
make the ActionBar Title be centered in the space between the "up"
logo on the left and the actions on the right, *without* modifying the
ActionBarSherlock project. Is there a way to do this? I was able to
get the behavior I wanted on pre-honeycomb devices by modifying the
layout file in ActionBarSherlock, but I am not sure how to do
accomplish this for a native ActionBar... I know that's outside the
realm of ABS, just thought I'd ask and see if you knew a way.
I know having a centered title is not the standard behavior for an
Android ActionBar, nonetheless, it is a request I need to attempt to
comply with. : (
To be clear I am hoping for a way I can make the title be centered for
all action bars (native and ABS) by just defining an attribute
somewhere in my xml style.
Below I added the android:layout_gravity="center" to the parent
LinearLayout of the title text views to get the behavior I want, which
of course only worked for ABS:
<LinearLayout xmlns:android="
http://schemas.android.com/apk/res/
android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:paddingRight="10dip">
<com.actionbarsherlock.internal.widget.ScrollingTextView
android:id="@+id/abs__action_bar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:singleLine="true"
android:marqueeRepeatLimit="marquee_forever"
/>
<com.actionbarsherlock.internal.widget.ScrollingTextView
android:id="@+id/abs__action_bar_subtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:singleLine="true"
android:marqueeRepeatLimit="marquee_forever"
android:visibility="gone"
/>
</LinearLayout>