实现Android 抽屉效果

<

div id=”content” contentScore=”126″>在Android开发过程中,我们喜欢使用特效,比如抽屉效果,这样可以给人很好的体验。点击一个按钮,就像拉抽屉一样展开界面,这样的效果正是我在这里所要说明的。比如在AVD或真机上,我们都有看过这种效果。比较常用的应用是LAUNCH应用。在这个应用中我们实现了拉抽屉呈现所有的程序,在这里我参考一些别人写的博客试例讲这种实现细节。
创建一个工程。在这里我命名为LauncherDemo.在这个例子中我在main.xml文件中写入如下,贴上代码:

  1. “1.0” encoding=“utf-8”?>   
  2. “http://schemas.android.com/apk/res/android”  
  3.     android:orientation=“vertical”  
  4.     android:layout_width=“fill_parent”  
  5.     android:layout_height=“fill_parent”  
  6.     >   
  7.     android:id=“@+id/slidingdrawer”  
  8.     android:layout_width=“fill_parent”  
  9.     android:layout_height=“fill_parent”  
  10.     android:orientation=“vertical”  
  11.     android:handle=“@+id/handle”  
  12.     android:content=“@+id/content”>   
  13.     
  14.         android:id=“@+id/handle”  
  15.         android:layout_width=“88dip”  
  16.         android:layout_height=“44dip”  
  17.         android:background=“@drawable/handle”  
  18.         />   
  19.     
  20.         android:id=“@+id/content”  
  21.         android:layout_width=“fill_parent”  
  22.         android:layout_height=“fill_parent”  
  23.         android:background=“#00ff00”>   
  24.      
  25.            
  26.        
  27.         android:id=“@+id/allapps”  
  28.         android:layout_width=“fill_parent”  
  29.         android:layout_height=“wrap_content”  
  30.     />