我在片段中加载图像时遇到问题,当我选择地点搜索图像并选择图片而不是它时我得到黑色圆圈,这是我的代码:
civ = view.findViewById(R.id.circle_profile);
civ.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent GaleryIntent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(GaleryIntent, RESULT_LOAD_IMAGE);
}
});
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RESULT_LOAD_IMAGE && resultCode == getActivity().RESULT_OK && null != data) {
Uri selectedImage = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getActivity().getContentResolver().query(selectedImage,filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
CircleImageView imageView = getActivity().findViewById(R.id.circle_profile);
imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
}
}
XML:
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_column="0"
android:layout_row="1"
android:layout_rowSpan="3"
android:layout_marginLeft="30dp"
android:layout_columnWeight="1"
android:id="@+id/circle_profile"
android:src="@drawable/profile"
app:civ_border_color="#FFFFFF"
app:civ_border_width="2dp"
/>
它看起来只剩下边框颜色
答案 0 :(得分:0)
我怀疑你的代码:
impdp userid=\'/ as sysdba\' dumpfile=exp_full.dmp directory=my_directory full=y sqlfile=myfile.sql
可能会因为图片大小很大而返回BitmapFactory.decodeFile(picturePath)
我建议使用null
并在decodeFile
函数内传递BitmapFactory.Options
作为第二个参数。
修改强>
BitmapFactory.Options
可以包含以下代码:
BitmapFactory.Options
希望它有所帮助!