Android重的SlidingDrawer的实例展示

 

主要还是XML的布局:main.xml

Code:
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:orientation="vertical"  
  4.     android:layout_width="fill_parent"  
  5.     android:layout_height="fill_parent"  
  6.     android:background="#808080"  
  7.     >  
  8. <SlidingDrawer  
  9.     android:id="@+id/slidingdrawer"  
  10.     android:orientation="vertical"  
  11.     android:layout_width="fill_parent"  
  12.     android:layout_height="fill_parent"  
  13.     android:handle="@+id/handle"  
  14.     android:content="@+id/content"  
  15.     >  
  16.     <Button  
  17.         android:id="@id/handle"  
  18.         android:layout_width="88dip"  
  19.         android:layout_height="44dip"  
  20.         android:background="@drawable/handle"  
  21.         />  
  22.     <LinearLayout  
  23.         android:id="@id/content"  
  24.         android:layout_width="fill_parent"  
  25.         android:layout_height="fill_parent"  
  26.         android:background="#00ff00"  
  27.         >  
  28.         <Button  
  29.             android:id="@+id/button"  
  30.             android:layout_width="wrap_content"  
  31.             android:layout_height="wrap_content"  
  32.             android:text="button"  
  33.             />  
  34.         <EditText  
  35.             android:id="@+id/text"  
  36.             android:layout_width="fill_parent"  
  37.             android:layout_height="wrap_content"  
  38.             />  
  39.     </LinearLayout>   
  40. </SlidingDrawer>  
  41. </LinearLayout>  

handle.xml

Code:
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <selector xmlns:android="http://schemas.android.com/apk/res/android">  
  3.     <item  
  4.         android:state_window_focused="false"  
  5.         android:drawable="@drawable/handle_normal"  
  6.         />  
  7.     <item  
  8.         android:state_pressed="true"  
  9.         android:drawable="@drawable/handle_pressed"  
  10.         />  
  11.     <item  
  12.         android:state_focused="true"  
  13.         android:state_enabled="true"  
  14.         android:drawable="@drawable/handle_focused"  
  15.         />  
  16.     <item  
  17.         android:state_focused="true"  
  18.         android:drawable="@drawable/handle_focused"  
  19.         />  
  20. </selector>  

 虽然简单,但是很实用!以后会用得着的!

你可能感兴趣的:(xml,android,layout,button,encoding)