I have 2 Toolbars
in the code below and I want to see them side by side. first should cover 80% of the width and remaining should be covered by the second toolbar. How can I do that. I can hard code the width like 200dip /100 dip but that does not work when I change mobile.. Screen bursts.
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="@style/AppTheme.AppBarOverlay"
android:layout_weight="1"
>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="0dip"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:layout_gravity="top|left"
android:layout_weight="0.8"/>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar1"
android:layout_width="0dip"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:layout_gravity="top|right"
android:layout_weight="0.2"/>
Please check below solution, it can help you
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top|left"
android:layout_weight="0.8"
android:background="?attr/colorPrimary">
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar1"
app:popupTheme="@style/AppTheme.PopupOverlay"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="top|right"
android:layout_weight="0.2"
android:background="?attr/colorPrimary">
</android.support.v7.widget.Toolbar>
</LinearLayout>
</android.support.design.widget.AppBarLayout>