打开键盘时的Textview重叠按钮?

时间:2017-06-07 07:03:39

标签: android textview android-linearlayout relativelayout

当我打开键盘时,我的textview与按钮重叠。当我打开键盘时,“作者信息”下面是重叠按钮。谁能告诉我出了什么问题?

<?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:background="@color/actionbar"
android:orientation="vertical" >

<ImageView
    android:id="@+id/imgLogo"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_gravity="center_horizontal"
    android:layout_marginBottom="10dp"
    android:layout_marginTop="60dp"
    android:src="@drawable/ic_launcher" />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/imgLogo"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="15dp"
    android:text="@string/title"
    android:textColor="@color/white"
    android:textSize="13dp" />

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:padding="20dp" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="15dp"
        android:text="@string/enter_name"
        android:textColor="@color/white"
        android:textSize="18dp" />

    <EditText
        android:id="@+id/username_input"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:imeActionId="@+id/login"
        android:layout_marginBottom="10dp"
        android:imeActionLabel="@string/action_sign_in_short"
        android:imeOptions="actionUnspecified"
        android:layout_marginTop="10dp"
        android:background="@color/white"
        android:inputType="textCapWords"
        android:padding="10dp" />

    <Button
        android:id="@+id/sign_in_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="40dp"
        android:background="@color/bg_btn_join"
        android:paddingLeft="25dp"
        android:paddingRight="25dp"
        android:text="@string/btn_join"
        android:textColor="@color/white" />
</LinearLayout>

<!-- author info -->

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_marginBottom="20dp"
    android:gravity="center_horizontal"
    android:orientation="vertical" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/author_name"
        android:textColor="@color/white"
        android:textSize="12dp" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/author_url"
        android:textColor="@color/white"
        android:textSize="12dp" />
</LinearLayout>

</RelativeLayout>

请帮我解决这个问题。我不希望我的textview重叠按钮。即使我打开键盘,它也应该保留在它的位置。

2 个答案:

答案 0 :(得分:0)

在清单集windowSoftInputMode =“adjustPan”上的活动中,活动的主窗口未调整大小以为软键盘腾出空间。有关详情,请查看https://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

答案 1 :(得分:0)

android:windowSoftInputMode="adjustPan|adjustResize"
相关问题