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,27 +29,22 @@
|
||||
<!-- As the main content view, the view below consumes the entire
|
||||
space available using match_parent in both dimensions. Note that
|
||||
this child does not specify android:layout_gravity attribute. -->
|
||||
<FrameLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
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.
|
||||
It needs to be a dynamic runtime call for correct vertical layering of
|
||||
the drawer and the toolbar. -->
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<!-- 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. -->
|
||||
android:layout_height="?attr/actionBarSize" />
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="?attr/actionBarSize"
|
||||
android:layout_gravity="top"
|
||||
android:scrollbarStyle="outsideOverlay">
|
||||
<TextView
|
||||
android:id="@+id/content_text"
|
||||
@@ -59,7 +54,7 @@
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:padding="16dp"/>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- android:layout_gravity="start" tells DrawerLayout to treat
|
||||
this as a sliding drawer on the starting side, which is
|
||||
|
||||
Reference in New Issue
Block a user