Есть ли способ перескочить только по тексту редактирования, а не по всей раскладке при открытии клавиатуры?

Я пытаюсь использовать фрагмент диалогового окна нижнего листа, но всякий раз, когда клавиатура открывает макет, он также перескакивает во фрагмент, например, recyclerview, уже попробованный с помощью adjustPan и adjustNothing, но безуспешно.

Может ли кто-нибудь помочь мне (нужно что-то похожее на раздел комментариев пользовательского интерфейса tiktok)

  • Пробовал это уже [ https://stackru.com/questions/55788594/remaking-tiktoks-comments-ui-sticky-edittext-at-the-bottom ], но в моем случае это не работает

Некоторый фрагмент xml, который я еще пробовал

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/relativeLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:id="@+id/no_of_comments"
            android:layout_width="match_parent"
            android:layout_height="36dp"
            android:gravity="center_vertical|center_horizontal"
            android:text="30.8k comments"
            android:textColor="@color/graycolor" />

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="300dp">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/comments_list"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

        </ScrollView>
        
    </LinearLayout>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_gravity="bottom"
        android:orientation="horizontal">

        <EditText
            android:id="@+id/editText"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/top_gray_line"
            android:hint="Leave a comment"
            android:paddingLeft="16dp"
            android:paddingRight="16dp"
            android:textSize="12sp" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentRight="true"
            android:alpha="0.3"
            android:background="@android:color/white"
            android:hapticFeedbackEnabled="true"
            android:src="@drawable/ic_send_pink" />

    </RelativeLayout>

</FrameLayout>

1 ответ

Вы можете попробовать следующее: activity_main:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="20dp"
    tools:context=".MainActivity" >

    <EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="126dp"
        android:ems="10"
        android:hint="This is EditText"
        android:gravity="center" >
    </EditText>

</RelativeLayout>

AndroidManifest:

<activity android:name=".MainActivity"
            android:windowSoftInputMode="stateVisible|adjustPan">
            <intent-filter>
                ...
            </intent-filter>
</activity>

Для вывода вроде:

Другие вопросы по тегам