android - Why does "wrap_content" doesn't work for any ...Layout in XML file using support.design.widgets? -
i here first time , have question. have xml file in android project.
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout_schedule" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/mainbackground" android:fitssystemwindows="true"> <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.toolbar android:id="@+id/toolbar_schedule" android:layout_width="match_parent" android:layout_height="?attr/actionbarsize" android:background="?attr/colorprimary" /> </android.support.design.widget.appbarlayout> </android.support.design.widget.coordinatorlayout> <android.support.design.widget.navigationview android:id="@+id/navigation_schedule" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerlayout="@layout/navigation_header" app:menu="@menu/menu_navigation" /> </android.support.v4.widget.drawerlayout>
but when want add layouts, example linearlayout, in coordinatorlayour after appbarlayout(with atribute layout_height = "wrap_content"), see, places @ begining of drawerlayout. cannt understand why so. what's wrong xml? or need add iany layouts programmly?
maybe problem here in height
of appbarlayout
.
try set it's height value in dp
, i.e. android:layout_height="?attr/actionbarsize"
or android:layout_height="50dp"
Comments
Post a Comment