抽屉效果的实现我们用到的控件有DrawerLayout和SlidingDrawer。当然网上还有好多大神们已经做好并且功能强大的抽屉框架了。能力有限只是会用大神们写好的框架但不怎么好改,所以就自己整理了下毕竟自己写的以后要改的话还能够知道怎么改。
1、DrawerLayout是支持包中的类所以它具有很好的兼容性,当然是用的时候也是需要进行具体指定的。那么在xml配置文件中是如下:
<!- 主标题 ->
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/green" >
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="45dp"
android:layout_height="wrap_content"
android:background="@drawable/bar_assortment" />
<TextView
android:id="@+id/tv_title"
style="@style/textColor"
android:layout_width="wrap_content"</