Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tuchangwei/ec7897c3714f4c59a653 to your computer and use it in GitHub Desktop.
Save tuchangwei/ec7897c3714f4c59a653 to your computer and use it in GitHub Desktop.
<!--抽屉效果, 有两部分组成,上边部分是主view, 下边部分是抽屉部分,抽屉部分的抽出方向由android:layout_gravity="start"这个参数决定-->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
//app为自定义namespace的名称
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- 主view由相对布局构成-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- framelayout占位-->
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorPrimary"
//通过加入自定义namgespace为前缀可引用自定义属性。
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<!-- 包含view,宽由控件内部决定,高与父控件相同,靠近父控件的右下方,距离右下各16dp-->
<include
layout="@layout/upload_menu"
android:id="@+id/uploadMenu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/upload_button_margin_right"
android:layout_marginBottom="@dimen/upload_button_margin_bottom"
android:visibility="visible" />
</RelativeLayout>
<fragment
android:id="@+id/navDrawer"
android:layout_width="@dimen/drawer_max_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:name="com.kenny.openimgur.fragments.NavFragment" />
</android.support.v4.widget.DrawerLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment