布局视图组——FrameLayout

作者:追风剑情 发布于:2015-7-13 21:05 分类:Android

在FrameLayout中添加多个视图,但每一个视图都堆叠在前一个上面。这在想将一系列图像变成动画,使得每次只有一个视图可见的情况下很有用。

  1. <RelativeLayout 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. tools:context="${relativePackage}.${activityClass}" >
  6.  
  7. <TextView
  8. android:id="@+id/lblComments"
  9. android:layout_width="wrap_content"
  10. android:layout_height="wrap_content"
  11. android:text="@string/hello_world" />
  12. <FrameLayout
  13. android:layout_width="wrap_content"
  14. android:layout_height="wrap_content"
  15. android:layout_alignLeft="@+id/lblComments"
  16. android:layout_below="@+id/lblComments"
  17. android:layout_centerHorizontal="true">
  18. <ImageView
  19. android:src="@drawable/droid"
  20. android:layout_width="wrap_content"
  21. android:layout_height="wrap_content"/>
  22. <Button
  23. android:layout_width="124dp"
  24. android:layout_height="wrap_content"
  25. android:text="Print Picture"/>
  26. </FrameLayout>
  27.  
  28. </RelativeLayout>

运行效果

fffffffffff.png

标签: Android

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号