Android重的SlidingDrawer的实例展示
16lz
2022-07-28
主要还是XML的布局:main.xml
Code:- <?xmlversion="1.0"encoding="utf-8"?>
- <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:background="#808080"
- >
- <SlidingDrawer
- android:id="@+id/slidingdrawer"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:handle="@+id/handle"
- android:content="@+id/content"
- >
- <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="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/text"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- />
- </LinearLayout>
- </SlidingDrawer>
- </LinearLayout>
handle.xml
Code:- <?xmlversion="1.0"encoding="utf-8"?>
- <selectorxmlns:android="http://schemas.android.com/apk/res/android">
- <item
- android:state_window_focused="false"
- android:drawable="@drawable/handle_normal"
- />
- <item
- android:state_pressed="true"
- android:drawable="@drawable/handle_pressed"
- />
- <item
- android:state_focused="true"
- android:state_enabled="true"
- android:drawable="@drawable/handle_focused"
- />
- <item
- android:state_focused="true"
- android:drawable="@drawable/handle_focused"
- />
- </selector>
虽然简单,但是很实用!以后会用得着的!
更多相关文章
- Android开发者实用代码片段 与大家分享
- Android(安卓)ui utils-简单实用的Android界面工具
- Android(安卓)ui utils-简单实用的Android界面工具
- Android(安卓)MVVM结合DataBinding的简单实用(Android(安卓)studi
- 安卓应用实用功能的技术实现:《Android消息推送实现》 | Android(
- Android(安卓)实用工具Hierarchy Viewer实战
- Android(安卓)实用工具Hierarchy Viewer实战
- android实用代码片段
- Android(安卓)实用工具Hierarchy Viewer实战