2

我有以下布局。当我点击 messageTextView 时,键盘只显示一半。它适用于模拟器中较大尺寸的屏幕,但不适用于 4*2 英寸屏幕。我想在屏幕尺寸较小时显示全键盘,例如 4*2 英寸

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="@android:color/white"
    android:orientation="vertical"
    android:padding="0dp"
    android:scrollbars="vertical"
    android:scrollbarStyle="outsideInset">
    <Button
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:gravity="bottom"
        android:id="@+id/closeButton"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:background="@drawable/QchatClose" />
    <ScrollView
        android:id="@+id/chatHistoryScrollView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/closeButton"
        android:layout_centerHorizontal="true"
        android:background="@android:drawable/editbox_background_normal"
        android:scrollbarStyle="outsideOverlay"
        android:scrollbars="vertical"
        android:fitsSystemWindows="true"
        android:layout_marginBottom="40dp"
        android:visibility="visible">
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="vertical"
            android:layout_marginBottom="40dp">
            <TextView
                android:id="@+id/historyTextView"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:textColor="#000000"
                android:textSize="14dp"
                android:padding="5dp" />
        </LinearLayout>
    </ScrollView>
    <EditText
        android:id="@+id/messageTextView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:background="@android:drawable/editbox_background_normal"
        android:ems="2"
        android:maxLines="2"
        android:hint="Type a Message Here!"
        android:textColor="#000000"
        android:layout_marginBottom="5dp"
        android:padding="5dp"
        android:scrollbars="vertical"
        android:scrollbarStyle="outsideOverlay"
        android:singleLine="false">
        <requestFocus />
    </EditText>
</RelativeLayout>
4

0 回答 0