Android 包装内容不';不要包装它';当图片被裁剪时,将显示内容
我正在使用裁剪图像,然后将其加载到此imageView:Android 包装内容不';不要包装它';当图片被裁剪时,将显示内容,android,image,layout,ontouch,Android,Image,Layout,Ontouch,我正在使用裁剪图像,然后将其加载到此imageView: <RelativeLayout android:id="@+id/activity_edit_image_relative_layout_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:l
<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重载),现在当我点击外星人周围的粉红色区域时,它告诉我我点击的图像不正确。有什么问题?将以下属性添加到ImageView:
android:adjustViewBounds="true"