here is my test code:
The first child View
of a DrawerLayout
is the main content View
, and it will be laid out to fill the DrawerLayout
regardless of the layout attributes you set on it.
If you want your TextView
to be the size you set, you need to wrap it in another ViewGroup
that acts as the main content View
. For example:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="ro.rotry.NdInnerViewAutoFillScreen">
<RelativeLayout android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:text="in drawerlayout"
android:textColor="@android:color/white"
android:background="@android:color/black"
android:layout_centerInParent="true"
android:layout_width="100dp"
android:layout_height="100dp"/>
</RelativeLayout>
<View android:id="@+id/drawer"
... />
</android.support.v4.widget.DrawerLayout>