MartinCz MartinCz - 1 month ago 7
Android Question

android: gap between icon and spinner

I would like to ask about the actionbar in the gmail app.

In the main activity, there is a spinner in the actionbar (Inbox, Sent, etc.) and there is no title.

I tried that in my app but there is a bigger gap between the app icon and the spinner than it is in gmail app.

I made the title both invisible and empty but still the gap is somehow bigger.

Do I have to make my own view definition for the actionbar to achieve the same effect?

Many thanks,


Thank you all for answers. The answer of matthias lead me to the following solution that worked like a charm:

public class ZeroPaddingArrayAdapter<T> extends ArrayAdapter<T> {

    public InboxTypeAdapter(Context context, int textViewResourceId, T[] objects) {
        super(context, textViewResourceId, objects);

    public static ArrayAdapter<CharSequence> createFromResource(Context context,
                                                                int textArrayResId, int textViewResId) {
        CharSequence[] strings = context.getResources().getTextArray(textArrayResId);
        return new ZeroPaddingArrayAdapter<CharSequence>(context, textViewResId, strings);

    public View getView(int position, View convertView, ViewGroup parent) {
        View view = super.getView(position, convertView, parent);
        return view;


For spinners:

getView() - Get the view of the currently selected item. getDropDownView() - Get the views that are displayed when spinner is open.

We only need to reduce the padding in getView().

Just use this adapter instead of the simple ArrayAdapter.