键盘覆盖了edittext的一部分 [英] keyboard covering part of edittext

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

问题描述

当我单击EditText时,键盘会弹出并覆盖EditText的一部分.我希望EditText 完全可见.

When I click on the EditText, the keyboard pops out and covers a part of the EditText. I want the EditText to be completely visible.

我尝试过AdjustPan和AdjustResize,但它们无法正常工作.我想做一个片段.

I have tried adjustPan and adjustResize and they are not working. I want to do this in a fragment.

这就是现在的样子

这就是我想要的样子

更新:

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#EAEAEA"
    android:clickable="true" >

    <RelativeLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:background="@android:color/white" >

        <TextView
            android:id="@+id/message_header"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_marginLeft="15dp"
            android:layout_marginStart="15dp"
            android:gravity="center_vertical"
            android:text="@string/messages"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/black" />

        <ImageView
            android:id="@+id/close_button"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginEnd="5dp"
            android:layout_marginRight="5dp"
            android:contentDescription="@null"
            android:paddingLeft="5dp"
            android:paddingRight="5dp"
            android:src="@drawable/close" />
    </RelativeLayout>

    <ListView
        android:id="@+id/message_area"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/edit_control"
        android:layout_below="@+id/imageSmsProfile"
        android:background="#EAEAEA"
        android:divider="@null"
        android:dividerHeight="0dp"
        android:fadeScrollbars="true"
        android:overScrollHeader="#EAEAEA" >
    </ListView>

    <com.monqi.kid.custom.CustomRoundedImageView
        android:id="@+id/imageSmsProfile"
        android:layout_width="@dimen/dimen_50dp"
        android:layout_height="@dimen/dimen_50dp"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:background="@drawable/rounded_rectangle_shape"
        android:scaleType="centerCrop"
        app:left_bottom_corner_radius="10dip"
        app:left_top_corner_radius="10dip"
        app:right_bottom_corner_radius="10dip"
        app:right_top_corner_radius="10dip" />

    <RelativeLayout
        android:id="@+id/edit_control"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:paddingLeft="5dp"
        android:paddingRight="5dp" >

        <EditText
            android:id="@+id/input_chat_message"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_marginBottom="2dp"
            android:layout_marginLeft="5dp"
            android:layout_toLeftOf="@+id/button_chat_send"
            android:layout_toStartOf="@+id/button_chat_send"
            android:background="@drawable/edittext_drawable"
            android:cursorVisible="false"
            android:ems="10"
            android:inputType="textImeMultiLine"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:paddingStart="10dp" >

            <requestFocus />
        </EditText>

        <Button
            android:id="@+id/button_chat_send"
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_marginBottom="2dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginTop="2dp"
            android:background="@drawable/send_button"
            android:text="@string/send"
            android:textColor="@android:color/white" />
    </RelativeLayout>
</RelativeLayout>

推荐答案

使用 android:windowSoftInputMode ="adjustResize | adjustPan"

这篇关于键盘覆盖了edittext的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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