亚托克斯 2017-05-14 09:23 采纳率: 58.3%
浏览 11207
已采纳

android,怎样让图片浮在布局的最上层,类似css zoom那种

android设计布局遇到一个问题图片说明
想实现image在两个不同背景色的layout的交线位置。
我想的方法是 通过below/above 将image固定在一个Layout下面,然后通过marginTOP=image.heigh/2”。
但结果是layout有一半被压在它没依赖的那个layout下面。
请问这个问题怎么解决

  • 写回答

5条回答 默认 最新

  • 接口的说法 2017-05-15 05:46
    关注

    不知道你的具体的需求情况, 但个人感觉布局合理的话实现不难吧..

     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical" android:layout_width="match_parent"
        android:layout_height="match_parent">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <TextView
                android:id="@+id/t1"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:background="#aaf23000"
                android:layout_weight="1"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:background="#3aa000"
                android:layout_weight="1"/>
        </LinearLayout>
        <ImageView
            android:layout_width="200dp"
            android:background="#ff0"
            android:layout_height="100dp"
            android:layout_centerInParent="true"/>
    </RelativeLayout>![图片说明](https://img-ask.csdn.net/upload/201705/15/1494827065_839148.png)
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容