[英]Android softkeyboard show/hide control problem
Here I wrote simple layout xml. 在这里,我写了简单的布局xml。 (with one listview and edittext) (具有一个listview和edittext)
When I activate this xml using common setContentView(R.layout.main); 当我使用常见的setContentView(R.layout.main)激活此xml时; soft keyboard is always appears from the bottom side. 软键盘始终从底部出现。 BUT, when I remove listview entry from xml, softkeyboard is not shown. 但是,当我从xml中删除listview条目时,未显示软键盘。
I have no idea what's the relation between listview and softkeyboard. 我不知道listview和softkeyboard之间是什么关系。
I searched similar questions from this site, and some articles mentioned solution using focus control. 我从该站点搜索了类似的问题,有些文章提到了使用焦点控制的解决方案。 But I want my xml have default focus at edittext without soft keyboard. 但是我希望我的xml在没有软键盘的情况下将默认焦点集中在edittext上。
Can someone give me an advise to how to solve this problem? 有人可以给我建议如何解决这个问题吗?
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="480px"
android:layout_height="762px"
android:layout_gravity="center"
android:background="@drawable/bg_blank"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:id="@+id/mylist"
android:layout_width="100px"
android:layout_height="200px"
android:layout_marginLeft="0px"
android:layout_marginTop="70px"
/>
<EditText
android:id="@+id/input1"
android:layout_width="200px"
android:layout_height="50px"
android:layout_marginLeft="64px"
android:layout_marginTop="400px"
/>
</RelativeLayout>
</FrameLayout>
尝试将此属性添加到清单文件中的活动中
<activity android:windowSoftInputMode="stateAlwaysHidden" android:name=".Demo"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.