I have created a custom action bar
ActionBar actionBar = getActivity().getActionBar(); actionBar.setCustomView(R.layout.action_bar_draft); actionBar.setDisplayShowCustomEnabled(true); actionbarFeed = (TextView) actionBar.getCustomView().findViewById(R.id.textView_blogtest); actionbarFeed.setText("My Photos and videos"); The problem is Text View is not align center
In my layout the text view is at center. when it come to action bar it is shifted to right side.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" > <TextView android:id="@+id/textView_blogtest" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="Medium Text" android:textAppearance="?android:attr/textAppearanceMedium" android:textColor="#000" /> </RelativeLayout> <style name="AppTheme.ActionBarStyle" parent="@style/Widget.Sherlock.ActionBar.Solid"> <item name="android:icon">@drawable/menu</item> <item name="android:background">#ffca36</item> <item name="background">#f66605</item> <item name="android:customNavigationLayout">@layout/action_bar</item> </style> 