如何在转到另一个后自动关注 Plaintext activity

How to automatically focus on Plaintext after going to another activity

我有一个空的 activity,上面只有纯文本。 我想要它,以便在用户点击将他定向到空 activity 的按钮后,它会自动在 PlainText 上 selects/focuses 带出内置 android 键盘准备好获取用户输入.

我试过了

        android:focusedByDefault="true"

但是在进入空 activity 后似乎没有任何作用。

你可以试试

editText.requestFocus(); 

你空 activity 的 onCreate() 方法

Set Focus on EditText 看这里。

注意:一般的问题是 EditText 中的“hot to remove auto focus”所以它会自动聚焦,所以也许你更改了 xml 的一些属性,请分享你的空白 activity xml和我们在一起。

你可以试试

editText.setFocusableInTouchMstrong textode(true);
editText.setFocusable(true);
editText.requestFocus();

你空 activity 的 onCreate() 方法