I am trying to display the counter at the same position where the default title for the action bar is displayed. I followed the instructions of a similar SO application here , so I managed to exclude the name, but still the counter position is not aligned to the left, as you can see in this screenshot

Here are the basic definitions of my application for reproducing this case:
AndroidMenifest.xml:
<application android:label="app" android:icon="@drawable/ic_launcher" android:theme="@style/Theme.AppCompat" > ... <activity android:name="gm.activities.ViewAllActivity"> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="gm.activities.MainActivity" /> </activity>
menu_view_all.xml:
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="gm.activities.ViewAllActivity"> <item android:id="@+id/spinner" android:title="will be replaced anyway" app:showAsAction="ifRoom" app:actionViewClass="android.widget.Spinner" android:layout_gravity="left" android:gravity="left"/> <item android:id="@+id/action_settings" android:title="@string/action_settings" android:orderInCategory="100" app:showAsAction="never" /> </menu>
and related activities:
public class ViewAllActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view_all_activity); getSupportActionBar().setDisplayShowTitleEnabled(false); ... @Override public boolean onCreateOptionsMenu(Menu menu) {
So - Is it possible to align the counter to the left of the action bar and how? Is it right to use a spinner inside the action bar and set it via the menu.xml file, like me?
android alignment android-actionbar android-ui android-actionbar-compat
Gyro
source share