Edittext在BottomSheetDialogFragment中变得挤压

问题描述 投票:1回答:1

我有一个BottomSheetDialogFragment,其中底部有edittext的简单布局文件和顶部的recyclerview,当用户点击edittext和软键盘打开并在edittext中写几行并尝试滚动它,在滚动期间如果我点击任何行edittext挤压自己以及BottomSheetDialogFragment混蛋就像渲染本身一样。

这是我的代码

layout_file:

<RelativeLayout
    android:id="@+id/layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background"
    android:orientation="vertical"
    app:behavior_hideable="true"
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

        <android.support.v4.widget.SwipeRefreshLayout
            android:id="@+id/swipeRefreshLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_above="@+id/etPostShare">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/rvNewMessage"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

            </android.support.v4.widget.SwipeRefreshLayout>

            <EditText
                android:id="@+id/etPostShare"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="@null"
                android:gravity="center|left"
                android:hint="Aa"
                android:inputType="textCapSentences|textMultiLine"
                android:isScrollContainer="true"
                android:maxHeight="60dp"
                android:maxLength="@integer/send_chat_txt_limit"
                android:maxLines="4"
                android:paddingLeft="18.4dp"
                android:paddingBottom="10dp"
                android:textSize="14.6sp" />

</RelativeLayout>

在这里,我附上了我的问题的图像和视频链接:

enter image description here

https://drive.google.com/file/d/1bADuzDQoWep8XPMQ4ypKCWJyD32Gtfwp/view?usp=sharing

android android-fragments android-edittext keyboard-events bottom-sheet
1个回答
0
投票

这适用于预览

 <RelativeLayout
            android:id="@+id/layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/holo_red_light"
            android:orientation="vertical"
            app:behavior_hideable="true"
            app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

            <android.support.v4.widget.SwipeRefreshLayout
                android:id="@+id/swipeRefreshLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/rvNewMessage"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"/>

            </android.support.v4.widget.SwipeRefreshLayout>

            <EditText
                android:id="@+id/etPostShare"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:background="@null"
                android:gravity="center|left"
                android:layout_alignParentBottom="true"
                android:hint="Aa\naa"
                android:inputType="textCapSentences|textMultiLine"
                android:isScrollContainer="true"
                android:maxHeight="60dp"
                android:maxLength="500"
                android:maxLines="4"
                android:paddingLeft="18.4dp"
                android:paddingBottom="10dp"
                android:textSize="14.6sp" />

        </RelativeLayout>
© www.soinside.com 2019 - 2024. All rights reserved.