安卓动画

一、抽屉效果

事例代码

  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:tools="http://schemas.android.com/tools"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. android:orientation="vertical" >
  6. <TextView
  7. android:layout_width="match_parent"
  8. android:layout_height="45dip"
  9. android:layout_centerInParent="true"
  10. android:background="#8866ff00"
  11. android:gravity="center"
  12. android:text="流量统计"
  13. android:textSize="25sp" />
  14. <LinearLayout
  15. android:layout_width="match_parent"
  16. android:layout_height="match_parent"
  17. android:orientation="vertical" >
  18. <View
  19. android:layout_width="match_parent"
  20. android:layout_height="100dip" />
  21. <SlidingDrawer
  22. android:id="@+id/sliding_drawer"
  23. android:layout_width="match_parent"
  24. android:layout_height="match_parent"
  25. android:content="@+id/mycontent"
  26. android:handle="@+id/myhandle"
  27. android:orientation="vertical" >
  28. <LinearLayout
  29. android:id="@id/myhandle"
  30. android:layout_width="match_parent"
  31. android:layout_height="wrap_content"
  32. android:orientation="vertical" >
  33. <ImageView
  34. android:layout_gravity="center"
  35. android:layout_width="wrap_content"
  36. android:layout_height="wrap_content"
  37. android:src="@drawable/lock" />
  38. </LinearLayout>
  39. <LinearLayout
  40. android:id="@id/mycontent"
  41. android:layout_width="match_parent"
  42. android:layout_height="match_parent"
  43. android:background="#44000000"
  44. android:gravity="center"
  45. android:orientation="vertical" >
  46. <TextView
  47. android:layout_width="wrap_content"
  48. android:layout_height="wrap_content"
  49. android:text="我是内容"
  50. android:textSize="20sp" />
  51. </LinearLayout>
  52. </SlidingDrawer>
  53. </LinearLayout>
  54. </LinearLayout>

注:好好看看代码,水平抽屉和垂直抽屉都可实现

SlidingDrawer 已经过时了 

  1. setContentView(R.layout.activity_trafficmanager);
  2. SlidingDrawer sd= (SlidingDrawer) findViewById(R.id.sliding_drawer);
  3. sd.open();






posted @ 2015-02-05 21:55  就不呵呵呵  阅读(128)  评论(0编辑  收藏  举报