Simple use of Android popupWindow

View inflate = View.inflate (PersonActivity.this , R.layout.popupwindow , null ) ;
 //The parameters here indicate setting the width and height of the
 popupwindow PopupWindow popupWindow = new PopupWindow(inflate, ViewGroup.LayoutParams. MATCH_PARENT , ViewGroup.LayoutParams .WRAP_CONTENT ) ;
popupWindow.setFocusable(true);
popupWindow.setBackgroundDrawable(new ColorDrawable());
LinearLayout layout = (LinearLayout) findViewById(R.id.ll_person_activity);

popupWindow.setAnimationStyle(R.style.contextMenuAnim);
//这里面的参数表示显示的位置
popupWindow.showAtLocation(layout, Gravity.BOTTOM, 0, 0);

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324656105&siteId=291194637