本文介绍了布局应该上去的时候软键盘排在前面视图中的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我有一个登录界面中,当我们点击编辑文本的SoftInput键盘覆盖两个小部件一个是TextView的,另一个是登录按钮,这是相对布局的一个问题,但我想,当我们选择任何编辑文本整体布局相对应变为Up,所有部件都是默认的Andr​​oid的softinput键盘上方可见。请建议我的正确的解决方案。

I have a problem that I have a login Screen in which when we click on Edit Text the SoftInput Keyboard override the two widgets One is TextView and another is Login Button which are in Relative Layout, but I want when we select any Edit Text the whole Relative layout should goes Up and all widgets are visible above the softinput Keyboard of Android default. Please suggest me for the right solution.

先谢谢了。

我的布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:background="#ffffff">
    <FrameLayout android:id="@+id/frame"
        android:layout_gravity="top|bottom|center_horizontal"
        android:layout_width="wrap_content" android:layout_marginTop="10dip" android:layout_height="wrap_content">

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:background="@drawable/logo" >
</ImageView>
    </FrameLayout>
    <RelativeLayout android:id="@+id/frameLayout1"
        android:layout_width="wrap_content" android:background="@drawable/login_box_bg"
        android:layout_gravity="center_horizontal" android:layout_height="220dip" android:layout_marginTop="20dip">
        <EditText android:id="@+id/ed_Login_Email"
            android:background="@drawable/login_input_bg" android:layout_gravity="center_horizontal" android:layout_marginTop="10dip" android:hint="Email:" android:paddingLeft="10dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="text" android:layout_centerHorizontal="true">
        </EditText>
        <EditText android:background="@drawable/login_input_bg" android:layout_gravity="center_horizontal" android:id="@+id/ed_Login_Pwd"
            android:inputType="textPassword" android:hint="Password:" android:paddingLeft="10dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="50dip" android:layout_centerHorizontal="true">
        </EditText>

        <ImageView
            android:id="@+id/img_Login_RememberUnchecked"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:background="@drawable/checkbox_unchkd_large" android:layout_gravity="top|left" android:layout_marginLeft="15dip" android:layout_marginTop="100dip" android:clickable="true"/>

        <TextView
            android:id="@+id/tv_Login_RememberMeUnchecked"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Remember Me" android:textColor="#000000" android:layout_gravity="top|left" android:layout_marginLeft="35dip" android:layout_marginTop="102dip" android:clickable="true"/>

        <Button
            android:id="@+id/btn_Login_Login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/tv_Login_RememberMeUnchecked"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="14dp"
            android:background="@drawable/login_btn_bg"
            android:text="LOG IN"
            android:textColor="#ffffff" />

        <TextView
            android:id="@+id/tv_Login_ForgotPwd"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="15dp"
            android:clickable="true"
            android:text="Forgot your password?"
            android:textColor="#000000" />

    </RelativeLayout>


</LinearLayout>

请参考以下图片为更多的理解:

Please refer below images for more understanding:

我曾尝试与机器人:windowSoftInputMode =stateVisible | adjustResize,但什么也没有发生,问题依旧相同

I have tried with android:windowSoftInputMode="stateVisible|adjustResize" but nothing happens, problem remains same.

推荐答案

请改变窗口软输入模式来调整,要改变模式为调整添加以下语句,在AndroidManifest文件的活动。

Please change the windows soft input mode to Resize , To change the mode to "resize" add the following statement to your activity in AndroidManifest file.

<activity android:name="YourActivityName" android:windowSoftInputMode="adjustResize">

这篇关于布局应该上去的时候软键盘排在前面视图中的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 03:47