我有一个位图,我正在从设备上的特定位置读取它,并将图像设置为 ImageView
scaledBitmap = BitmapFactory.decodeFile(selectedImagePath);
ivImage.setImageBitmap(scaledBitmap);
这就是我为该 imageview 设置 xml 代码的方式
<ImageView
android:id="@+id/ivImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:layout_centerHorizontal="true"
android:scaleType="fitXY" />
有没有办法删除 ImageView 内图像上方的空白?
最佳答案
尝试将 android:scaleType="fitXY"
更改为 android:scaleType="centerCrop"
关于java - Android - 获取imageview内的图像以完全填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36255387/