裁剪图片时,换行内容不会换行它的内容
Wrap content doesn't wrap it's content when the picture is cropped
我正在使用 this 裁剪图像,然后将其加载到此 imageView:
<RelativeLayout
android:id="@+id/activity_edit_image_relative_layout_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/activity_edit_image_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff2299"
android:scaleType="fitCenter"
android:src="@drawable/phone" />
</RelativeLayout>
我给图像视图背景的颜色是粉红色(所以很容易发现),相关布局将作为视图组,我将在 运行时间.
粉红色背景必须只出现在具有透明背景(png 文件)的图像中(此图片未裁剪)
但是当我裁剪图像并将其加载到图像视图时,我得到了这个
粉色背景不能出现。问题是我试图弄清楚用户在图像上的哪个位置点击(为 imageView 重载 onTouch)现在当我点击 Alien 周围的粉红色区域时它告诉我我正在点击不正确的图像.有什么问题吗?
将以下 属性 添加到您的 ImageView:
android:adjustViewBounds="true"
我正在使用 this 裁剪图像,然后将其加载到此 imageView:
<RelativeLayout
android:id="@+id/activity_edit_image_relative_layout_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<ImageView
android:id="@+id/activity_edit_image_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff2299"
android:scaleType="fitCenter"
android:src="@drawable/phone" />
</RelativeLayout>
我给图像视图背景的颜色是粉红色(所以很容易发现),相关布局将作为视图组,我将在 运行时间.
粉红色背景必须只出现在具有透明背景(png 文件)的图像中(此图片未裁剪)
但是当我裁剪图像并将其加载到图像视图时,我得到了这个
粉色背景不能出现。问题是我试图弄清楚用户在图像上的哪个位置点击(为 imageView 重载 onTouch)现在当我点击 Alien 周围的粉红色区域时它告诉我我正在点击不正确的图像.有什么问题吗?
将以下 属性 添加到您的 ImageView:
android:adjustViewBounds="true"