android -- 之PopupWindow的使用

LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View contentView = inflater.inflate(R.layout.popwindow, null);
PopupWindow popupWindow = new PopupWindow(contentView,
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
popupWindow.setBackgroundDrawable(MainActivity.this.getResources()
.getDrawable(R.drawable.ic_launcher));
popupWindow.setFocusable(true);

popupWindow.showAsDropDown(v);

 

posted @ 2015-09-21 10:10  Android开发8585  阅读(164)  评论(0编辑  收藏  举报