Android对SlidingDraw组件修改


1. 引言

    在Android中,对SlidingDraw组件进行修改,将SlidingDraw组件的把手(手柄)改成左右两个Button,单击或拖动第一个Button响应SlidingDraw所有默认动作,第二个Button也随第一个Button动而动,单击第二个Button,可以启动一个Activity或弹出Dialog,第二个Button不响应SlidingDraw的任何默认动作。

2. 效果图:

    (1) 效果图1:

          效果图1

    (2) 效果图2:

          效果图2

3. 功能实现

    (1) 主布局(main.xml)实现:  

  1. <?xml version="1.0" encoding="utf-8"?>   
  2. <LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"  
  3.     xmlns:flyfot = "http://schemas.android.com/apk/res/com.focus.fishme"  
  4.     android:layout_width = "fill_parent"  
  5.     android:layout_height = "fill_parent"  
  6.     >   
  7.     <com.focus.fishme.FishMeSlidingDrawer   
  8.         android:id = "@+id/slidingDrawer"  
  9.         android:layout_width = "fill_parent"  
  10.         android:layout_height = "fill_parent"  
  11.         flyfot:handle = "@+id/dragger"  
  12.         flyfot:content = "@+id/content"  
  13.         >   
  14.            
  15.         <LinearLayout   
  16.             android:id = "@+id/dragger"     
  17.             android:layout_width = "wrap_content"  
  18.             android:layout_height = "wrap_content"  
  19.             >   
  20.             <Button    
  21.                 android:id = "@+id/mainButton"  
  22.                 android:layout_width = "wrap_content"     
  23.                 android:layout_height = "wrap_content"  
  24.                 android:text = "DRAWER1"  
  25.                 android:clickable = "false"  
  26.                 />   
  27.                    
  28.             <Button    
  29.                 android:id = "@+id/phoneButton"  
  30.                 android:layout_width = "wrap_content"     
  31.                 android:layout_height = "wrap_content"  
  32.                 android:text = "DRAWER2"  
  33.                 />   
  34.         </LinearLayout>   
  35.               
  36.         <LinearLayout   
  37.             android:id = "@+id/content"  
  38.             android:layout_width = "fill_parent"  
  39.             android:layout_height = "fill_parent"  
  40.             android:background = "#00FF00">   
  41.                
  42.         </LinearLayout>     
  43.            
  44.     </com.focus.fishme.FishMeSlidingDrawer>   
  45.        
  46. </LinearLayout>  
  • 1
  • 2
  • 下一页

相关内容