464637258 2015-07-22 02:25 采纳率: 57.1%
浏览 4005

RelativeLayout的wrap_content和里面内容的alignParent冲突问题

直接贴出来我想要的效果吧。可能我的思路从开始就错的。效果图
如题。问题我知道出在哪。就是布局的冲突了。但是实在想不好别的写法能替代了。
也查不到有人提出过对此的好的解决办法。
倒是可以直接在代码里写布局。这样理论上没啥写不出来的布局了。不过我还是尽量不想在代码里处理布局问题了。

     <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">

        <!--用于显示图标的imageView-->        
        <ImageView
            android:layout_width="80sp"
            android:layout_height="80sp"
            android:layout_marginRight="@dimen/small_circle_radius_half"
            android:layout_marginTop="@dimen/small_circle_radius_half"
            android:scaleType="fitXY"
            android:id="@+id/linearLayoutContainer">

        </ImageView>

        <!--右上角的红叉-->
        <ImageView
            android:layout_width="@dimen/small_circle_radius"
            android:layout_height="@dimen/small_circle_radius"
            android:scaleType="fitXY"
            android:src="@drawable/delete"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"/>
    </RelativeLayout>
  • 写回答

14条回答 默认 最新

  • lht80s 2015-07-22 03:17
    关注

    如果想让叉号覆盖在第一个图片的右上角就这样写:
    android:layout_alignRight="@id/linearLayoutContainer"
    android:layout_alignTop="@id/linearLayoutContainer"

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥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