0

我有两个图像视图,我试图在相对布局的屏幕上定位。但是,其中一张图像的左边缘在一个部分中向左突出,而其余部分只是一条直线。我希望其他图像与直线的直线部分对齐,而不是突出的额外部分。

不,我不能编辑图像资源,我不会详细介绍所有细节,我只会说我需要所有的片段。

这是我正在尝试做的一个非常丑陋的图像:

在此处输入图像描述

我尝试了以下方法:

 <ImageView
    android:id="@+id/block"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/interior"
    android:layout_toLeftOf="@+id/open_wall"
    android:layout_marginRight="-10dp"
    android:src="@drawable/block" />

但它也不起作用(尝试过 paddingRight)。我认为因为视图将自身锚定在 open_wall 图像的最左侧,所以如果你愿意,它不会让你越过那条分界线。

有没有人知道我可以做些什么来得到我想要的东西?

编辑:根据要求,我正在尝试使用的图像:

红色的(我图中的红色)

黑色的(我图中的黑色)

4

1 回答 1

0

干得好:

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

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="51dip"
        android:src="@drawable/red" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:paddingLeft="28dip"
        android:src="@drawable/black" />
 </RelativeLayout>

您唯一需要做的就是稍微调整一下这两个dip值,因为我没有与您一样分辨率的资源。

这是它的样子:

在此处输入图像描述

于 2012-12-07T00:22:52.837 回答