0

In my ActionBar, I have only one option menu item, and it only has icon and no text.

enter image description here

The context menu icon and the logo are well aligned (center vertical) but the material tv icon (24d - 96x96) looks collapsed. I'm not able to figure out how to make it the exact height as the context menu icon's height. Here is the part of my AppBarLayout file:

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay">

        <ImageView
            android:id="@+id/imgToolbarLogo"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:src="@drawable/dunya_logo_white" />


    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

The menu item is:

    <item
    android:id="@+id/action_watch_live"
    android:icon="@drawable/ic_tv_white"
    android:title=""
    android:orderInCategory="1"
    app:showAsAction="always"/>

Please help me how to central align this material icon like the Context Menu icon on the left.

Falak Marri
  • 211
  • 3
  • 15
  • I don't want to display the text. I just want the icon to appear nicely, centrally aligned (vertically), just like the context menu icon on the left. – Falak Marri Jul 12 '17 at 13:48
  • https://developer.android.com/guide/practices/screens_support.html , icons for different densities – Pavneet_Singh Jul 12 '17 at 13:53

1 Answers1

4

I think your Image Drawable Folder not correct so, Try to Inset The Correct Image sizes in correct Drawable folder.can you refer the following links

http://iconhandbook.co.uk/reference/chart/android/

What is the recommended ActionBar icon size in Material Design (Android API 21+)?

Kabilan
  • 191
  • 10
  • You were right, I hadn't added the icon using Android Studio's Add Image Asset tool which resizes the image according to the standard action bar menu icons. I added the image using 'Add Image Asset' wizard and my issue has been resolved, it automatically places the icons in their corresponding folders. – Falak Marri Jul 12 '17 at 14:33