当焦点的EditText,EditText上因此未跳出SoftKeyboard [英] when focus EditText ,EditText didnot pop out the SoftKeyboard

查看:131
本文介绍了当焦点的EditText,EditText上因此未跳出SoftKeyboard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Yes.It是我layout.when使用我的EditText我question.When我重点或触摸EDITTEXT,他们因此未弹出软键盘。

Yes.It is my question.When I using edittext in my layout.when I focus or touch the Edittext,them didnot pop out the soft keyboard.

这是我的布局:

```
    

```

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:descendantFocusability="blocksDescendants"
        android:focusable="false"
        android:orientation="vertical"
        android:weightSum="1.0" >

        <RelativeLayout
          ...........................
          ...........................
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:focusable="false"
            android:gravity="center"
            android:orientation="horizontal"
            android:weightSum="1.0" >

            <EditText
                android:id="@+id/detail_query_txt"
                android:paddingTop="15dp"
                android:layout_alignParentTop="true"
                android:layout_width="fill_parent"
                android:layout_height="40dp"
                android:gravity="center"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:inputType="phone" >

                <requestFocus />
            </EditText>

            <Button
                android:id="@+id/detail_query_but"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/detail_query_txt"
                android:focusable="false"
                android:text="@string/word_query" />
        </RelativeLayout>
    </LinearLayout>

</ScrollView>

```
现在:我因此未在我的Java类文件编写任何code

``` Now:I didnot write any code in my java class file

我试着一路网络告诉我们,所有的失败。
这是我测试的方式:
的android:windowSoftInputMode =stateVisible添加到Mainifest活动---->失败结果
它弹出软键盘,但指针来上课,不是的EditText

I try all the way the Network tell us,all it failed. this is the way i test: android:windowSoftInputMode="stateVisible" add to Activity in Mainifest ----> failed
it pop out the Soft keyboard,but pointer to class,not the edittext

等等......结果
有人能帮我解决这个问题。

and so on...
someone help me to solve the problem.

推荐答案

删除的android:descendantFocusability =从您的LinearLayoutblocksDescendants
我想你的code,它的工作。

Remove android:descendantFocusability="blocksDescendants" from your LinearLayout. I tried your code, it worked.

希望它帮助。

编辑:

Explaination:

属性的android:descendantFocusability =blocksDescendants简单的的LinearLayout < STRONG>将焦点到decendant视图。

the attribute android:descendantFocusability="blocksDescendants" simply blocks your LinearLayout to give focus to the decendant view .

的LinearLayout =的Decendants 的LinearLayout

Decendants of LinearLayout= all the child views of LinearLayout

这篇关于当焦点的EditText,EditText上因此未跳出SoftKeyboard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆