0

我的应用程序如下所示:

键盘隐藏

如您所见,有一些用于测量的文本视图,下面是一些信息的文本视图(其中显示蓝牙已断开连接......),最后是一个编辑文本字段以发布内容。当你按下写东西时,键盘会出现,但只有最后一个文本视图会移动并与测量值重叠,如下所示:

键盘开启

我真的不在乎屏幕是否调整大小或平移,我已经尝试了清单文件中的所有属性(nothing,adjustResize,adjustPan)但没有成功,同样的事情发生了......

我还尝试用图标删除所有这些文本视图,只留下一个简单的文本视图。同样的事情:只有最后一个文本视图移动......

布局是使用片段构建的以滑动视图:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:orientation="vertical">

<android.support.v4.view.ViewPager
    android:id="@+id/viewPager"
    android:layout_centerInParent="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

<android.support.v4.view.PagerTabStrip
    android:id="@+id/pager_tab_strip"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top"
    android:background="#33b5e5"
    android:textColor="#fff"
    android:paddingTop="5dp"
    android:paddingBottom="5dp" />

</android.support.v4.view.ViewPager>

</RelativeLayout>

我们遇到问题的特定片段具有以下布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RelativeLayout
        android:id="@+id/layout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:drawableStart="@drawable/pm25resized"
            android:text="PM 2.5μm" />

        <TextView
            android:id="@+id/send1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="22sp"
            android:layout_alignParentRight="true"
            android:text="μg/m3" />

    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/layout2"
        android:layout_below="@id/layout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_height="wrap_content"
            android:textSize="20sp"
            android:drawableStart="@drawable/pm10resized"
            android:text="PM 10μm" />

        <TextView
            android:id="@+id/send2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="22sp"
            android:layout_alignParentRight="true"
            android:text="μg/m3" />

    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/layout3"
        android:layout_below="@id/layout2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:textSize="20sp"
            android:layout_alignParentLeft="true"
            android:layout_height="wrap_content"
            android:drawableStart="@drawable/humidityresized"
            android:text="Humidity" />

        <TextView
            android:id="@+id/send3"
            android:textSize="22sp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:text="%" />

    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/layout4"
        android:layout_below="@id/layout3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView5"
            android:textSize="20sp"
            android:layout_width="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_height="wrap_content"
            android:drawableStart="@drawable/temperatureresized"
            android:text="Temperature" />

        <TextView
            android:id="@+id/send4"
            android:textSize="22sp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:text="°C" />

    </RelativeLayout>

    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="60dp"
        android:scrollbars="vertical" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_height="60dp" >

        <EditText
            android:id="@+id/editText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/send"
            android:layout_marginRight="40dp"
            android:layout_marginBottom="0dp"
            android:hint="@string/edittext_hint"
            android:singleLine="false" />

        <Button
            android:id="@+id/send"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:layout_height="40dp"
            android:layout_width="40dp"
            android:layout_marginRight="6dp"
            android:background="@drawable/send512" />

    </RelativeLayout>

</RelativeLayout>

有任何想法吗???

4

0 回答 0