2

I know this might seem like a duplicate question, in fact I have already referred to these questions here and here, but none of these seem to work for me, so here I am .

My layout has two primary sections in it : a live video feed and a chat box below it, what happens is that whenever I open the keyboard it shifts my video section and the appbar upwards and out of the screen, and I want he video section to stay as it is , I have tried many things like different layouts, windowSoftInputMode, but none helped.

Here Is my Layout :

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/linearLayout7">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            app:layout_constraintBottom_toBottomOf="@+id/constraintLayout2" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/constraintLayout2"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_gravity="bottom"
            android:layout_weight="1"
            android:orientation="vertical"
            android:visibility="visible"
            app:layout_constraintBottom_toBottomOf="parent">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                app:layout_constraintBottom_toTopOf="@+id/linearLayout3">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <androidx.core.widget.NestedScrollView
                        android:id="@+id/tscroll"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingTop="42dp"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent">

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

                    </androidx.core.widget.NestedScrollView>

                </androidx.constraintlayout.widget.ConstraintLayout>
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout3"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:background="@drawable/chatbox"
                android:weightSum="3"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent">

                <EditText
                    android:imeOptions="flagNoExtractUi"
                    android:id="@+id/textmassge"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="2.2"
                    android:autofillHints=""
                    android:hint="@string/enter_message"
                    android:inputType="text"
                    android:textColor="@color/colorPrimary"
                    android:textColorHint="@color/colorSelect"
                    android:textSize="20sp" />

                <ImageView
                    android:id="@+id/attach"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.4"
                    android:background="@android:color/transparent"
                    android:onClick="choose_file"
                    android:padding="13dp"
                    android:src="@drawable/attachment"
                    android:tint="@color/colorAccent" />

                <ImageView
                    android:id="@+id/send_button"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.4"
                    android:background="@android:color/transparent"
                    android:onClick="sendmessage"
                    android:padding="13dp"
                    android:src="@drawable/send"
                    android:tint="@color/colorAccent" />
            </LinearLayout>
        </androidx.constraintlayout.widget.ConstraintLayout>

    </LinearLayout>

    <!--GLSurface View Starts-->

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="2"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/linearLayout7">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/mainlayout"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            app:layout_constraintBottom_toBottomOf="@+id/constraintLayout2">

            <android.opengl.GLSurfaceView
                android:id="@+id/cameraPreview_surfaceView"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:visibility="visible"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintDimensionRatio="1:1"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

        </androidx.constraintlayout.widget.ConstraintLayout>

    </LinearLayout>

   
</androidx.constraintlayout.widget.ConstraintLayout>
ibrhm117
  • 387
  • 3
  • 25

0 Answers0