【问题标题】:Android - Show numeric keyboard without an EditTextAndroid - 显示没有 EditText 的数字键盘
【发布时间】:2016-01-24 02:56:10
【问题描述】:

对于我的 Android 应用,我需要在用户单击图像时显示数字键盘,但不显示 EditText。 然后我想在用户按下特定键时收到通知,以便我可以适当地处理 UI。

怎么可能呢? 谢谢

【问题讨论】:

    标签: java android


    【解决方案1】:

    试试这个...

    InputMethodManager inputMethodManager =  (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
    inputMethodManager.toggleSoftInputFromWindow(imageview_reference.getApplicationWindowToken(),     InputMethodManager.SHOW_FORCED, 0);
    

    【讨论】:

    • 谢谢!但是按键事件的监听器呢?
    • 我会使用TextWatcher 进行监控。让我看看还有什么。你能给我们一个更好的用例吗?数字是静态的吗?是动态的
    • 是的,这很好用,但是如果设备有硬件键盘,键盘就不会出现
    猜你喜欢
    • 1970-01-01
    • 2013-08-23
    • 2021-01-27
    • 2010-11-10
    • 1970-01-01
    • 2014-10-05
    • 1970-01-01
    相关资源
    最近更新 更多