码迷,mamicode.com
首页 > 移动开发 > 详细

安卓动画

时间:2015-02-05 23:13:16      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:

一、抽屉效果

事例代码

  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();






安卓动画

标签:

原文地址:http://www.cnblogs.com/candledragle/p/0be523995ff8baa9593c8f57cf064c3e.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!