Android's imageView has a serious flaw: it makes my image into a square frame, with the rest as white space. How can I fix this? I have tried scale type, but it didn't work. Thank you.
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/header"
android:scaleType="fitStart"
android:src="@drawable/img_001" />
</RelativeLayout>
没有你的代码我只能猜测,但我建议你添加 xml 属性android:adjustViewBounds="true"
或者在您的活动中,为 imageview 提供该属性imageView.setAdjustViewBounds(true)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)