Simplify the content layout of the DrawerLayout demo.
No need to overcomplicate things with FrameLayout and margins. Vertical LinearLayout does the job for this specific case. Change-Id: I23bf53cc2a90b602f8956782a0c0af1e20a8cd52
This commit is contained in:
@@ -29,37 +29,32 @@
|
|||||||
<!-- As the main content view, the view below consumes the entire
|
<!-- As the main content view, the view below consumes the entire
|
||||||
space available using match_parent in both dimensions. Note that
|
space available using match_parent in both dimensions. Note that
|
||||||
this child does not specify android:layout_gravity attribute. -->
|
this child does not specify android:layout_gravity attribute. -->
|
||||||
<FrameLayout
|
<LinearLayout
|
||||||
android:id="@+id/content"
|
android:id="@+id/content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
<!-- This will be set as the support action bar of the activity at runtime.
|
<!-- This will be set as the support action bar of the activity at runtime.
|
||||||
It needs to be a dynamic runtime call for correct vertical layering of
|
It needs to be a dynamic runtime call for correct vertical layering of
|
||||||
the drawer and the toolbar. -->
|
the drawer and the toolbar. -->
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="?attr/actionBarSize" />
|
||||||
<!-- Note layout_marginTop attribute with action bar height as the value.
|
|
||||||
This "pushes" down the main content so that it doesn't overlap with
|
|
||||||
the toolbar. Note the usage of layout_gravity that addresses a bug in
|
|
||||||
FrameLayout on v9 and older devices that didn't correctly treat the
|
|
||||||
margin attributes. -->
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scrollbarStyle="outsideOverlay">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/content_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:text="@string/drawer_layout_summary"
|
||||||
android:layout_gravity="top"
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
android:scrollbarStyle="outsideOverlay">
|
android:padding="16dp"/>
|
||||||
<TextView
|
|
||||||
android:id="@+id/content_text"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:text="@string/drawer_layout_summary"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:padding="16dp"/>
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</FrameLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- android:layout_gravity="start" tells DrawerLayout to treat
|
<!-- android:layout_gravity="start" tells DrawerLayout to treat
|
||||||
this as a sliding drawer on the starting side, which is
|
this as a sliding drawer on the starting side, which is
|
||||||
|
|||||||
Reference in New Issue
Block a user