开发者

Android softkeyboard show/hide control problem

开发者 https://www.devze.com 2023-03-30 05:13 出处:网络
Here I wrote simple layout xml. 开发者_运维知识库(with one listview and edittext) When I activate this xml using common setContentView(R.layout.main);

Here I wrote simple layout xml. 开发者_运维知识库(with one listview and edittext)

When I activate this xml using common setContentView(R.layout.main); soft keyboard is always appears from the bottom side. BUT, when I remove listview entry from xml, softkeyboard is not shown.

I have no idea what's the relation between listview and 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.

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>


try adding this attribute to your activity in the manifest file

<activity android:windowSoftInputMode="stateAlwaysHidden" android:name=".Demo"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消