简体   繁体   English

单击EditText不会显示键盘吗?

[英]Click on EditText won't show the keyboard?

I have a table whose tapping on a cell changes its content and displays some edit texts. 我有一张桌子,点击它的单元格会更改其内容并显示一些编辑文本。 The first of these edit texts requests the focus, but oddly when I tap on it, the keyboard doesn't show. 这些编辑文本中的第一个请求焦点,但是奇怪的是,当我点击它时,键盘没有显示。 It is when I tap the others edit texts though. 当我点击其他人编辑文本时。 What should I do? 我该怎么办? Here is how I implemented my first edit text. 这是我实现第一个编辑文本的方式。

<EditText
    android:id="@+id/editContent"
    android:layout_width="match_parent"
    android:layout_height="120dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="5dp"
    android:gravity="top"
    android:inputType="textMultiLine" >
    </requestFocus>
</EditText>

When I don't request the focus, there is also a strange behaviour: it opens the keyboard when I tap it but my edit text loses the focus and I've to tap it again to write in it. 当我不请求焦点时,还有一个奇怪的行为:当我点击它时,它会打开键盘,但是我的编辑文本会失去焦点,因此我必须再次点按它才能写出来。

I found the problem, it was because of this line in the Activity block of the Manifest : 我发现了问题,这是因为清单文件的活动块中的这一行:

android:windowSoftInputMode="stateHidden"

I changed it by : 我通过以下方式进行了更改:

android:windowSoftInputMode="adjustPan"

Works well now. 现在运作良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM