搜索

首页  >  问答  >  正文

android - 怎么把图片设置在两个布局的边缘上

如图怎么设置这样的效果,图片在两个布局边缘上这个activity下面有一个正在播放视频的activity,我用帧布局已设置透明就全透明了。

淡淡烟草味淡淡烟草味2824 天前946

全部回复(2)我来回复

  • 習慣沉默

    習慣沉默2017-05-16 13:36:07

    不知道是不是这个效果

    代码:

    <?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

    回复
    0
  • PHPz

    PHPz2017-05-16 13:36:07

    使用锚点。例子可以网上搜或者Studio中File-New-Activity-ScrollingActivity创建一个自带的默认模板,里面布局就是

    回复
    0
  • 取消回复