【问题标题】:trying to disable focusable, not working, android试图禁用可聚焦,不工作,android
【发布时间】:2013-01-21 14:04:41
【问题描述】:

我正在使用 android 中的库连接到终端仿真器,它连接到串行设备(开关)并显示发送/接收的数据。我使用另一个库通过串行发送数据。我通过终端下方的文本框或在终端本身输入并在两种情况下都按键盘上的 Enter 键通过连接发送数据。

但是我想禁用终端输入,所以我尝试将可聚焦设置为 false。我仍然可以输入它,还有其他方法可以禁用在视图中输入吗?

<jackpal.androidterm.emulatorview.EmulatorView
        android:id="@+id/emulatorView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/term_entry"
        android:layout_below="@+id/deviceConnect"
        android:layout_toRightOf="@+id/scrllyout"
        android:focusable="false"
        android:focusableInTouchMode="false" />

【问题讨论】:

    标签: java android focus


    【解决方案1】:

    看EmulatorView的源码,看到了这个函数:

    @Override
    public boolean onCheckIsTextEditor() {
        return true;
    }
    

    也许您可以将其更改为返回 false,看看它是否能解决您的问题。 如果这没有帮助,请检查

    @Override
    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {}
    

    source code

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-29
    • 1970-01-01
    • 2014-05-05
    • 1970-01-01
    • 2018-07-11
    • 2016-01-17
    相关资源
    最近更新 更多