新闻popwindow

来源:互联网 发布:看漫画的软件 编辑:程序博客网 时间:2024/06/05 16:05
private void showPopupWindow(final int i, final String title) {    //设置contentView    View contentView = LayoutInflater.from(context).inflate(R.layout.mypop, null);    pop = new PopupWindow(contentView,            ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT, true);    pop.setContentView(contentView);    pop.setBackgroundDrawable(new ColorDrawable());    pop.setOutsideTouchable(true);    pop.setFocusable(true);    //设置各个控件的点击响应    TextView tv3 = (TextView)contentView.findViewById(R.id.delet);    TextView tv4= (TextView) contentView.findViewById(R.id.sc);    tv3.setOnClickListener(new View.OnClickListener() {        @Override        public void onClick(View view) {            pop.dismiss();            listbean.remove(i);            notifyDataSetChanged();        }    });    //显示PopupWindow    View rootview = LayoutInflater.from(context).inflate(R.layout.activity_main, null);    pop.showAtLocation(rootview, Gravity.RIGHT,0, 0);}
原创粉丝点击