Android开发学习:[27]SlidingDrawer

2024-10-12 22:15:53

1、首先我们先建一个Activity并且设置为启动项,一定要记得设置intent-filter来设置启动项

Android开发学习:[27]SlidingDrawer

2、然后我们在布局的xml里面添加以下代码,记得要有handle和content的内容<LinearLayout 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="com.basillee.asus.demo.MainActivity9"> <SlidingDrawer android:layout_width="match_parent" android:layout_height="match_parent" android:content="@+id/content" android:handle="@+id/handle" android:id="@+id/slidingDrawer"> <ImageView android:id="@id/handle" android:layout_width="50dip" android:layout_height="44dip" android:src="@drawable/a"/> <LinearLayout android:id="@id/content" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/ripple_material_light"> <TextView android:id="@+id/txt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="SlidingDrawerTest"/> </LinearLayout> </SlidingDrawer></LinearLayout>下面是Design窗体的可视化视图

Android开发学习:[27]SlidingDrawerAndroid开发学习:[27]SlidingDrawer

5、下面各图是对于slidingDrawer运行状态的事件处理的各种截图。

Android开发学习:[27]SlidingDrawerAndroid开发学习:[27]SlidingDrawer
猜你喜欢