Using the new Android 5.0 Toolbar approach, and following the Google IO example, I'm setting a navigation icon and a spinner in the toolbar.
The issue is, the navigation icon is BOTTOM-aligned. I can't find any reason why this is happening...
[Note that I deliberately set it to a solid square to see the alignment issue more clearly]
My code is as follows:
toolbar.xml
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:theme="@style/ActionBarThemeOverlay"
app:popupTheme="@style/ActionBarPopupThemeOverlay"
android:id="@+id/toolbar_actionbar"
android:layout_width="match_parent"
android:layout_height="?android:actionBarSize"
/>
Main Style
<style name="ActionBarThemeOverlay" parent="">
<item name="android:background">@color/appMainColor</item>
<item name="android:textColorPrimary">#fff</item>
<item name="colorControlNormal">#ffff</item>
<item name="colorControlHighlight">#3fff</item>
</style>
ActivityMain
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
if (mActionBarToolbar != null)
mActionBarToolbar.setNavigationIcon(R.drawable.ic_drawer);
android.widget.Toolbar. A standard toolbar for use within application content. A Toolbar is a generalization of action bars for use within application layouts.
Try to use ?attr/actionBarSize instead of android:layout_height="?android:actionBarSize"
<android.support.v7.widget.Toolbar
android:layout_height="?attr/actionBarSize">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With