Popup window is similar to dialog box in android
//Sample code
LayoutInflater inflater = (LayoutInflater) HairMagic.this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int deviceWidth = displayMetrics.widthPixels;
int deviceHeight = displayMetrics.heightPixels;
popupWindow = new PopupWindow(inflater.inflate(R.layout.colorpopup,
null, false), deviceWidth, deviceHeight / 3, true);
popupWindow.showAtLocation(findViewById(R.id.relative_bottom),
Gravity.BOTTOM, 0, 0);
View myPoppyView = popupWindow.getContentView();
Button btnClose = (Button) myPoppyView.findViewById(R.id.btnColorClose);
//---------------------------------------------------
0 comments: