实现Android 抽屉效果
2010 年 4 月 30 日
<
div id=”content” contentScore=”126″>在Android开发过程中,我们喜欢使用特效,比如抽屉效果,这样可以给人很好的体验。点击一个按钮,就像拉抽屉一样展开界面,这样的效果正是我在这里所要说明的。比如在AVD或真机上,我们都有看过这种效果。比较常用的应用是LAUNCH应用。在这个应用中我们实现了拉抽屉呈现所有的程序,在这里我参考一些别人写的博客试例讲这种实现细节。
创建一个工程。在这里我命名为LauncherDemo.在这个例子中我在main.xml文件中写入如下,贴上代码:
- “1.0” encoding=“utf-8”?>
“http://schemas.android.com/apk/res/android” - android:orientation=“vertical”
- android:layout_width=“fill_parent”
- android:layout_height=“fill_parent”
- >
- android:id=“@+id/slidingdrawer”
- android:layout_width=“fill_parent”
- android:layout_height=“fill_parent”
- android:orientation=“vertical”
- android:handle=“@+id/handle”
- android:content=“@+id/content”>
- android:id=“@+id/handle”
- android:layout_width=“88dip”
- android:layout_height=“44dip”
- android:background=“@drawable/handle”
- />
-
- android:id=“@+id/content”
- android:layout_width=“fill_parent”
- android:layout_height=“fill_parent”
- android:background=“#00ff00”>
-
- android:id=“@+id/allapps”
- android:layout_width=“fill_parent”
- android:layout_height=“wrap_content”
- />