2 u011402798 u011402798 于 2013.07.27 01:03 提问

android popupwindow dismiss()关闭窗体前的处理事件
            pop.setTouchable(true);
pop.setBackgroundDrawable(new BitmapDrawable()); //

上面两句代码当点击窗体外部popupwindow自动消失
我想让popupwindow消失前执行一段代码,比如改变字体等,那么如何重写dismiss()方法啊?

贴出部分源码
public void popup() {//
inflater = (LayoutInflater)popupTest.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View listLayout = inflater.inflate(R.layout.listview, null);
listView= (ListView) listLayout.findViewById(android.R.id.list);
lvButtonAdapter listItemAdapter =
new lvButtonAdapter(this,list1, R.layout.item, new String[]{"text1","text2","ItemImage,RelativeLayout"}, new int[]{R.id.text1,R.id.text2,R.id.pup,R.id.re});

listView.setAdapter(listItemAdapter);
listView.setFocusable(true);
listView.setItemsCanFocus(true);

listView.setOnItemClickListener(new OnItemClickListener(){public void onItemClick(AdapterView<?> arg0, View arg1,int arg2, long arg3) { edit1.getText().insert (edit1.getSelectionStart(),list1.get(arg2).get("text1").toString()); pop.dismiss(); }});//光标处插入文字

pop = new PopupWindow(listLayout, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
pop.setTouchable(true);
pop.setBackgroundDrawable(new BitmapDrawable()); //

            pop.setFocusable(true);





    }  

1个回答

mianbaocheng
mianbaocheng   2013.07.30 10:52
已采纳

window.setOnDismissListener()添加一个消失的监听

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!