0
对于原型中的布局,我需要一个按钮,将ImageView的一个部分(一个内部矩形)与放大的图像进行叠加,以保留宽高比。 有没有一些方法来覆盖图像视图上的按钮与定义的边距,然后扩大这种组合保留边距?我试图把两者都放在一个额外的相关布局中,但子元素没有在相关布局中进行缩放(比如在缩放父UIView时可能会缩放2个UIViews)。我也尝试使用adjustViewBounds将imageview缩小到放大的图像,但是这也不起作用。匹配缩放图像视图按钮
这是当前布局
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0dp"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/placeholderImage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/placeholder"
android:padding="0dp"
android:adjustViewBounds="true"/>
<Button
android:id="@+id/btn"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/darker_gray"
android:onClick="show"/>
</RelativeLayout>
您是否尝试在版面中添加重量? layout_weight = 1等 – Saqib