我想设置为我在Android API 23 CircleImageView图像我从设备的存储器中的图像路径和存储这个字符串数据库路径:setImageDrawable没有设置图像上API23
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/fragment_edit_picture"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_gravity="center"
android:layout_margin="5dp"
android:src="@mipmap/ic_launcher"
android:onClick="selectFromGallery"
app:civ_border_width="2dp"
/>
它正在处理API 19和之前的版本,但它不适用于Genymotion中的Android版本API 23中的虚拟设备。所选图像未在ImageView中显示。我将图像设置为ImageView:
mCurrentImagePath = FileUtils.getPath(getActivity(), selectedImageUri);
Log.d(TAG, "mCurrentImagePath: " + mCurrentImagePath);
// Update client's picture
if (mCurrentImagePath != null && !mCurrentImagePath.isEmpty()) {
fragmentEditPicture.setImageDrawable(new BitmapDrawable(getResources(),
FileUtils.getResizedBitmap(mCurrentImagePath, 512, 512)));
}
图像路径是mCurrentImagePath: /storage/emulated/0/Download/56836_(5-27-2006 2-28-40)(1920x1200).JPG
。
你知道为什么这不起作用吗?
您是否在运行时请求了所需的权限? –
@OgnianGloushkov号它没有得到任何错误或异常。它只是不设置图像。 –