FrameLayout布局中不讓图片叠加的方法.docxVIP

  • 12
  • 0
  • 约2.11千字
  • 约 3页
  • 2016-11-26 发布于重庆
  • 举报

FrameLayout布局中不讓图片叠加的方法.docx

FrameLayout布局中不讓图片叠加的方法

FrameLayout布局中不让图片叠加的方法 声明:以下内容只是个人观点,如有建议愿共同探讨,不喜勿喷谢谢(by小武) 当我们要为文字或图片设置背景时,往往会用到FrameLayout布局,但是当多个ImageView需 要显示在FrameLayout中时,你会发现最后只会显示一张图片,那么其他去哪了呢? 答案就是,这些 图片会叠加在一起,为了不让这种情况发生我们要做些“手脚”,试试在FrameLayout中加入一个 RelativeLayout,你会发现这样之后会很轻松 代码如下: FrameLayout xmlns:android=/apk/res/android xmlns:tools=/tools android:layout_width=wrap_content android:layout_height=match_parent android:background=@drawable/background_img RelativeLayout android:layout_width=fill_parent android:layout_height=fill_parent com.example.lol.TimeView android:id=@+id/time android:layout_width=fill_parent android:layout_height=30dp / FrameLayout android:id=@+id/hero_bg android:layout_width=350dp android:layout_height=180dp android:layout_below=@+id/time android:layout_centerHorizontal=true android:background=@drawable/hero_sel_img RelativeLayout android:layout_width=fill_parent android:layout_height=fill_parent ImageView android:id=@+id/ahri_square_0 android:layout_width=50dp android:layout_height=50dp android:layout_marginLeft=5dp android:layout_marginTop=10dp android:src=@drawable/ahri_square_0 / ImageView android:id=@+id/akali_square_0 android:layout_width=50dp android:layout_height=50dp android:layout_marginLeft=60dp android:layout_marginTop=10dp android:src=@drawable/akali_square_0 / ImageView android:id=@+id/amumu_square_0 android:layout_width=50dp android:layout_height=50dp android:layout_marginLeft=115dp android:layout_marginTop=10dp android:src=@drawable/amumu_square_0 / /RelativeLayout /FrameLayout Button android:id=@+id/enter android:layout_width=70dp android:layout_height=30dp android

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档