android - 怎么把图片设置在两个布局的边缘上
本文介绍了android - 怎么把图片设置在两个布局的边缘上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
如图怎么设置这样的效果,图片在两个布局边缘上这个activity下面有一个正在播放视频的activity,我用帧布局已设置透明就全透明了。
解决方案
不知道是不是这个效果
代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/holo_green_dark"
android:clipChildren="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@android:color/darker_gray">
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="bottom"
android:src="@mipmap/ic_launcher"/>
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
关键在这句代码:
android:clipChildren="false"
解释:
是否限制子View在其范围内 默认为true
这篇关于android - 怎么把图片设置在两个布局的边缘上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文