一. 实例说明
![](https://img.haomeiwen.com/i14297357/a7c12bc0ba606368.png)
二. 关键技术
主要利用 SlidingDrawer
控件与该控件的 orientation
属性,handle
属性和content
属性。
三. 代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!--设置抽屉控件-->
<SlidingDrawer
android:id="@+id/SlidingDrawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:content="@id/myView"
android:handle="@id/layout1"
android:orientation="horizontal">
<!--设置引导按钮-->
<LinearLayout
android:id="@+id/layout1"
android:layout_width="35dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/Image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"/>
</LinearLayout>
<!--设置抽屉内容-->
<ImageView
android:id="@+id/myView"
android:src="@mipmap/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</SlidingDrawer>
</RelativeLayout>
https://github.com/Frioa/My200Application/tree/master/slidingdrawer
网友评论