aliehuhu
V2EX  ›  Android

点击返回键怎么让 popupwindow 消失?

  •  
  •   aliehuhu · Jun 18, 2018 · 14551 views
    This topic created in 3076 days ago, the information mentioned may be changed or developed.
    代码如图:


    现在问题是第一按返回键,软键盘关闭;
    第二次按返回键,popupwindow 才关闭,setOnKeyListener 那段代码没生效。
    5 replies  •  2018-06-18 10:49:25 +08:00
    sundae91
    sundae91
    Jun 18, 2018❤️1
    1
    复写 onBackPressed()方法
    yanhejihe
    yanhejihe
    Jun 18, 2018❤️1
    2
    这个我处理过,是 popupwindow 的一个大坑
    yanhejihe
    yanhejihe
    Jun 18, 2018❤️1
    3
    推荐还没入坑的换 bottom sheet 或 dialog fragment
    yanhejihe
    yanhejihe
    Jun 18, 2018
    4
    没注意看代码,和我的不大一样。你这个应该是键盘关闭事件监听的问题。
    xingda920813
    xingda920813
    Jun 18, 2018 via Android
    5
    setOnPreImeListener
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4507 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 07:30 · PVG 15:30 · LAX 23:30 · JFK 02:30
    ♥ Do have faith in what you're doing.