由网友(祈欢)分享简介:Android的ImageView的有一个严重的缺陷:它使我的形象成方形框架,其余部分为空白。我该如何解决这个问题?我曾尝试规模类型,但没有奏效。谢谢。Android's imageView has a serious flaw: it makes my image into a square frame, with...
Android的ImageView的有一个严重的缺陷:它使我的形象成方形框架,其余部分为空白。我该如何解决这个问题?我曾尝试规模类型,但没有奏效。谢谢。
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>
推荐答案
没有你的code我只能猜测,但我建议你添加任意的XML属性安卓adjustViewBounds =真
或你的活动,给那个带属性的ImageView的 imageView.setAdjustViewBounds(真)
Without your code I can only guess, but I suggest that you add either the xml attribute android:adjustViewBounds="true"
or in your activity, give the imageview that attribute with imageView.setAdjustViewBounds(true)
相关推荐
最新文章