SoftKeyboard将我的TextViews移出显示状态

时间:2013-07-22 06:55:41

标签: android screen android-softkeyboard

我知道之前有问过这个问题,但我找到的所有答案对我都没有用。这是我的问题:

当我调用我的玩家活动(输入玩家名称)时,它看起来像这样:

enter image description here

但是当我点击01. Player时会发生这种情况:

enter image description here

我无法向上滚动。

我希望显示器将第一个玩家保留在屏幕上,而不是将玩家1到3移出屏幕。

继承我的XML:

<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    tools:ignore="UselessParent" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        tools:ignore="ScrollViewSize" >

        <TextView
            android:id="@+id/TV_player01"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player02"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player02"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player03"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player03"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player04"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player04"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player05"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player05"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player06"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player06"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player07"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player07"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player08"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player08"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player09"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player09"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player10"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player10"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player11"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player11"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player12"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player12"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player13"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player13"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player14"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player14"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player15"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player15"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:nextFocusDown="@+id/TV_player16"
            android:textAllCaps="false" />

        <TextView
            android:id="@+id/TV_player16"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3"
            android:clickable="true"
            android:ems="10"
            android:textAllCaps="false" />
    </LinearLayout>
</ScrollView>

<LinearLayout
    android:id="@+id/CONT_laynameinputbottom"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="4" >

    <EditText
        android:id="@+id/ET_nameinput"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="3"
        android:ems="10"
        android:inputType="text|textCapWords"
        android:maxLength="16"
        android:selectAllOnFocus="true"
        android:textAllCaps="false"
        tools:ignore="NestedWeights" >

        <requestFocus />
    </EditText>

    <LinearLayout
        android:id="@+id/CONT_ni_button"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="3"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/BTN_ni_exit"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3" />

        <Button
            android:id="@+id/BTN_ni_next"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3" />

        <Space
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3" />

        <Button
            android:id="@+id/BTN_ni_clearall"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="3" />

    </LinearLayout>
</LinearLayout>

请帮助

编辑:我也添加了我的清单。

清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="bowltec.control"
    android:versionCode="1"
    android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="16"
    tools:ignore="OldTargetApi" />

<supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="bowltec.control.MainFrame"
        android:screenOrientation="landscape" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="bowltec.control.GameSettings"
        android:screenOrientation="landscape" />
    <activity
        android:name="bowltec.control.ConfirmChosen"
        android:screenOrientation="landscape" />
    <activity
        android:name="bowltec.control.NameInput"
        android:screenOrientation="landscape"
        android:windowSoftInputMode="adjustResize" />
    <activity
        android:name="bowltec.control.GameList"
        android:screenOrientation="landscape" />
    <activity
        android:name="bowltec.control.Correction"
        android:screenOrientation="landscape" />
    <activity
        android:name="bowltec.control.Menu"
        android:screenOrientation="landscape" />
    <activity
        android:name="bowltec.control.Language"
        android:screenOrientation="landscape" />
    <activity
        android:name="bowltec.control.AddLang"
        android:screenOrientation="landscape" />
</application>

1 个答案:

答案 0 :(得分:0)

您可以在AndroidManifest中使用windowSoftInputMode。

<activity
        android:name="com.example.Activity"
        android:label="@string/app_name"
        android:windowSoftInputMode="adjustResize" >

Lars Vogel在他的blog上发布了关于此功能的一小段内容。 Android Developers Blog

还有更多内容