如何设置相对于另一个图像视图的图像

时间:2017-11-13 19:25:14

标签: android user-interface imageview

我想在另一张图片上设置图片。 基本图像为3600px X 2400px(WxH) 我要插入的图像有以下条件: - X:471px Y:282px W:1053px H:936px  X& Y是相对于基本图像的。 所有坐标都在px。

2 个答案:

答案 0 :(得分:1)

使用一个相对低于一个的RelativeLayout和一些边距(可能是填充)我在所有参数中都省略了android:

<RelativeLayout layout_width="wrap_content" layout_height="wrap_content">
   <ImageView
      id="@+id/firstOne"
      layout_width="360px" layout_height="240px" />
   <ImageView
      belowOf="@+id/firstOne"
      marginTop="28px"
      marginLeft="47px"
      layout_width="105px" layout_height="93px" />
 </RelativeLayout>

我将所有值缩小了10以便您可以看到结果,但是您需要找到一个相对解决方案,其中包含wrap_contents + adjustViewBounds和scaleMatrix = fitXY

答案 1 :(得分:0)

使用FrameLayout。通常,FrameLayout用于保存单个子视图,否则很难。 See the documentation