使用するpopupWindow mWindow.showAtLocation (view Gravity.NO_GRAVITY, -100, -100);
ソースコードで ViewManager の処理が addView X <0, Y <0 であることを知っていますか?
使用するpopupWindow mWindow.showAtLocation (view Gravity.NO_GRAVITY, -100, -100);
ソースコードで ViewManager の処理が addView X <0, Y <0 であることを知っていますか?
このコードは私のために働いています 試してください
public void btnMyPicsClick(View v) {
thredFlag = 1;
outLineImage.setVisibility(View.INVISIBLE);
saveImageAdapter = new SaveImageAdapter(DrawAppActivity.this);
LayoutInflater inflater = (LayoutInflater) DrawAppActivity.this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
final PopupWindow popupWindow = new PopupWindow(inflater.inflate(
R.layout.mypicturesgrid, null, false), 1230, 250, true);
popupWindow.showAtLocation(findViewById(R.id.relativeLayoutBottom),
Gravity.LEFT, 30, -240);
View myPoppyView = popupWindow.getContentView();
Button btnClose = (Button) myPoppyView.findViewById(R.id.btnColorClose);
GridView gvOutLine = (GridView) myPoppyView
.findViewById(R.id.gvOutline);
gvOutLine.setAdapter(saveImageAdapter);
gvOutLine.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v, int position,
long id) {
// TODO Auto-generated method stub
String path = saveImageAdapter.fileName[position]
.getAbsolutePath();
File file = new File(path);
Uri uri = Uri.fromFile(file);
myPicImageUri = Uri.fromFile(file);
DisplayMetrics metrics = getApplicationContext().getResources()
.getDisplayMetrics();
int w = metrics.widthPixels;
int h = metrics.heightPixels;
Bitmap bmp;
try {
bmp = BitmapFactory.decodeStream(getContentResolver()
.openInputStream(uri));
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bmp, w, h,
true);
drawingSurface.setBitmap(scaledBitmap);
drawingSurface.clear();
popupWindow.dismiss();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
btnClose.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
popupWindow.dismiss();
}
});
}