[英]Resize LinearLayout or RelativeLayout after resizing ImageView inside it
I have to put an ImageView inside a RelativeLayout. 我必须将ImageView放在RelativeLayout中。 Just like this:
像这样:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imagen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@drawable/image1"/>
</RelativeLayout>
I know that this image will be resized in some devices because it would be too big for the device's screen. 我知道此图像将在某些设备中调整大小,因为对于设备的屏幕而言太大了。 The remaining resized layout is something like this , notice the gray area around the image, wich is the original RelativeLayout BEFORE resizing, I think!
剩下的调整大小的布局是这样的 ,请注意图像周围的灰色区域,我认为这是调整大小之前的原始RelativeLayout!
How can I remove that remaining space? 如何删除剩余空间? Thanks!
谢谢!
Try this 尝试这个
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imagen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/image1"/>
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.