我使用android中的库连接到终端模拟器,它连接到串行设备(交换机)并显示发送/接收的数据。我使用另一个库通过串行发送数据。我通过终端下方的文本框通过连接发送数据,或者通过键入终端本身并在两种情况下点击键盘上的输入。
但是我想禁用终端输入,所以我尝试将focusable设置为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" />
答案 0 :(得分:1)
查看EmulatorView的源代码,我看到了这个函数:
@Override
public boolean onCheckIsTextEditor() {
return true;
}
也许您可以将其更改为返回false,并查看它是否可以解决您的问题。 如果这没有帮助,请检查
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {}
请参阅source code