View inflate = View.inflate(FilmDetailsActivity.this, R.layout.pop_film_yugao, null);
final PopupWindow popupWindow = new PopupWindow(inflate, WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
//设置外面可触
popupWindow.setOutsideTouchable(true);
//设置可触
popupWindow.setFocusable(false);
//设置背景,保证点击popupwindow外关闭
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#aa000000")));
popupWindow.setTouchable(true);
popupWindow.showAtLocation(filmDetailsPage, Gravity.BOTTOM, 0, 0);
popupWindow.showAsDropDown(filmDetailsXiangqing);
ImageView back = inflate.findViewById(R.id.film_pop_back);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//消失
popupWindow.dismiss();
}
});
TextView name = inflate.findViewById(R.id.film_pop_names);
name.setText(""+result.getName());
PopWindow的使用
猜你喜欢
转载自blog.csdn.net/weixin_43731179/article/details/89488630
今日推荐
周排行