popupwindow popupmenu
2020-12-13 14:16
标签:http io os sp strong on 2014 代码 bs private void iniPopupWindow() { LayoutInflater inflater = (LayoutInflater) this .getSystemService(LAYOUT_INFLATER_SERVICE); lvPopupList.setAdapter(); // 控制popupwindow点击屏幕其他地方消失 // 更多操作按钮 @Override if (pwMyPopWindow.isShowing()) { pwMyPopWindow.dismiss();// 关闭 pwMyPopWindow.showAsDropDown(ibOperationMore);// 显示 } popupwindow popupmenu 标签:http io os sp strong on 2014 代码 bs 原文地址:http://my.oschina.net/u/1389206/blog/338581
View layout = inflater.inflate(R.layout.task_detail_popupwindow, null);
pwMyPopWindow = new PopupWindow(layout);
pwMyPopWindow.setFocusable(true);// 加上这个popupwindow中的ListView才可以接收点击事件
pwMyPopWindow.setBackgroundDrawable(this.getResources().getDrawable(
R.drawable.bg_popupwindow));// 设置背景图片,不能在布局中设置,要通过代码来设置
pwMyPopWindow.setOutsideTouchable(true);// 触摸popupwindow外部,popupwindow消失。这个要求你的popupwindow要有背景图片才可以成功,如上
ibOperationMore = (ImageButton) findViewById(R.id.ib_operate_more);
ibOperationMore.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
} else {
}
});