软键盘来过的EditText [英] Soft Keyboard comes over the EditText

查看:123
本文介绍了软键盘来过的EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse ADT来开发Android应用程序。当焦点过来的EditText上的一个(在页面下端)键盘覆盖的EditText所以当我键入的文字,我看不到什么在被键入。我有什么选择?

I am using Eclipse ADT to develop an Android application. When focus comes over one of the EditText(at lower end of page) the keypad covers the EditText so when I am keying text, I can't see what's being keyed in. What are my options ?

索引活动中的布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:background="#a8e8f0" android:orientation="vertical" android:id="@+id/layout">
    <LinearLayout android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/welcome_background">
        <include layout="@layout/top"></include>
        <RelativeLayout android:layout_height="wrap_content"
            android:layout_width="fill_parent" android:gravity="center">
            <LinearLayout android:layout_width="270dp"
                android:orientation="vertical" android:layout_height="wrap_content"
                android:id="@+id/body">
                <ImageView android:layout_width="wrap_content" android:src="@drawable/welcome_title" android:layout_height="wrap_content" android:id="@+id/title" style="@style/Theme.Connector.ImageElement"></ImageView>
                <TextView android:text="@string/welcome_text" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/txt_welcome" style="@style/Theme.Connector.FormText"></TextView>
                <Spinner android:layout_width="fill_parent"
                    android:layout_height="wrap_content" style="@style/Theme.Connector.WelcomeSpinner"
                    android:layout_weight="1" android:id="@+id/spinner_isp" />
                <EditText android:layout_height="wrap_content" android:singleLine="true"
                    style="@style/Theme.Connector.WelcomeInput" android:hint="@string/txt_user"
                    android:layout_width="fill_parent" android:id="@+id/edit_user"></EditText>
                <EditText android:layout_alignParentLeft="true"  android:singleLine="true"
                    android:layout_height="wrap_content" style="@style/Theme.Connector.WelcomeInput"
                    android:hint="@string/txt_password" android:layout_width="fill_parent"
                    android:password="true" android:id="@+id/edit_password"/>
                <LinearLayout android:layout_width="fill_parent"
                    android:orientation="horizontal" android:layout_height="fill_parent"
                    android:id="@+id/frm_action">
                    <Button style="@style/Theme.Connector.Button"
                        android:layout_height="wrap_content" android:layout_width="100dp"
                        android:text="@string/btn_cancel" android:layout_weight="1"
                        android:id="@+id/btn_cancel" />
                    <Button android:text="@string/btn_continue"
                        android:layout_height="wrap_content" android:layout_width="100dp"
                        style="@style/Theme.Connector.ButtonContinue"
                        android:layout_weight="1" android:id="@+id/btn_continue"></Button>
                </LinearLayout>
            </LinearLayout>
        </RelativeLayout>
    </LinearLayout>
</LinearLayout>

的Andr​​oidManifest.xml

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application android:icon="@drawable/icon" android:label="@string/app_name"
        android:theme="@style/Theme.Connector">

        <activity android:name=".IndexActivity" android:label="@string/app_name"
            android:screenOrientation="portrait" android:windowSoftInputMode="stateVisible|adjustPan">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name=".WiFiBroadcastReceiver">
            <intent-filter>
                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
            </intent-filter>
        </receiver>

    </application>
</manifest>

键盘

推荐答案

您的包裹外LinerLayout在滚动型的,例如,

Wrap your outer LinerLayout in a ScrollView, e.g.,

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    ...

    <!-- Your current layout here -->

</ScrollView>

这应该允许滚动布局看下部的EditText

This should allow scrolling your layout to see the lower EditText

这篇关于软键盘来过的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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