Android_launcher抽屉类SlidingDrawer的使用.docx
文本预览下载声明
Android_launcher抽屉类SlidingDrawer的使用
新建Android工程,命名为SlidingDrawer.
准备素材.
设置layout布局
LinearLayout xmlns:android=/apk/res/android
xmlns:tools=/tools
android:layout_width=match_parent
android:layout_height=match_parent
android:background=#808080
android:orientation=vertical
android:paddingBottom=@dimen/activity_vertical_margin
android:paddingLeft=@dimen/activity_horizontal_margin
android:paddingRight=@dimen/activity_horizontal_margin
android:paddingTop=@dimen/activity_vertical_margin
tools:context=com.tian.test.MainActivity
SlidingDrawer
android:id=@+id/slidingdrawer
android:layout_width=match_parent
android:layout_height=match_parent
android:content=@+id/content
android:handle=@+id/handle
android:orientation=vertical
Button
android:id=@+id/handle
android:layout_width=88dip
android:layout_height=44dip
android:background=@drawable/handle /
LinearLayout
android:id=@+id/content
android:layout_width=match_parent
android:layout_height=match_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=match_parent
android:layout_height=wrap_content /
/LinearLayout
/SlidingDrawer
/LinearLayout
设置handle 图标的样式,在drawable里添加handle.xml
?xml version=1.0 encoding=utf-8?
selector xmlns:android=/apk/res/android
item android:drawable=@drawable/handle_normal android:state_window_focused=false/
item android:drawable=@drawable/handle_pressed android:state_pressed=true/
item android:drawable=@drawable/handle_focused android:state_enabled=true android:state_focused=true/
item androi
显示全部