以下の画像を透明に作成します。
<ImageView
android:id="@+id/imageView1"
android:onClick="setimag"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/back"
android:background="@drawable/ic_launcher" />
あなたの画像とic_launcherはどこにあるのですか?
protected void onActivityResult(int requestCode, int resultCode,
Intent imageReturnedIntent) {
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
switch (requestCode) {
case 100:
if (resultCode == RESULT_OK) {
Uri selectedImage = imageReturnedIntent.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImage,
filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String filePath = cursor.getString(columnIndex);
cursor.close();
Bitmap yourSelectedImage = BitmapFactory.decodeFile(filePath);
ImageView imgv = (ImageView) findViewById(R.id.imageView1);
// imgv.setImageBitmap(yourSelectedImage);
Drawable d = new BitmapDrawable(getResources(),
yourSelectedImage);
imgv.setBackgroundDrawable(d);
}
}
}