最近在网上看帖子的时候,看见有人提到了Launcher涉及的抽屉类SlidingDrawer,查阅相关资料写了一个简单的Demo,供大家参考,有什么不足之处,希望和大家交流!有更好的想法可以再后面跟帖,大家互相讨论!
备注:SlidingDrawer中handler就是点击的监听器,content为显示的内容界面
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#808080">
<SlidingDrawer
android:id="@+id/sliding_drawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:handle="@+id/handle"
android:content="@+id/content"
>
<Button
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/handle"
/>
<LinearLayout
android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00ff00"
>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
/>
<EditText
android:id="@+id/editText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</SlidingDrawer>
</LinearLayout>
备注:SlidingDrawer中handler就是点击的监听器,content为显示的内容界面