android studio 2.0 beta5
I have noticed that when I include a layout inside a Toolbar the left edge of that layout never aligns to the left edge of the toolbar's parent even though I have set both to match_parent.
This is my xml snippet
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@android:color/transparent"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp">
</LinearLayout>
</android.support.v7.widget.Toolbar>
This is a screenshot of what is happening.
As you can see from the above picture the LinearLayout doesn't match the parent. I have also tried FrameLayout
and RelativeLayout
as well with the same result.
I am not sure if this is a bug with android studio or this space on the left is reserved for something.
Even when I run the app on a real device it doesn't match the parent either.
Many thanks for any suggestions
Just put android:contentInsetStart="0dp" inside:
<android.support.v7.widget.Toolbar....
contentInsetStart="0dp"
...</>
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