余雪 2013-07-26 17:03 采纳率: 0%
浏览 15625
已采纳

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 2013-07-30 02:52
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料