0

I have a view with a title bar above (RelativeLayout) and below a LinearLayout with weightSum. I used the weightSum because I wanted to distribute the three elements (ImageView, TextView, Button ) 100% contained in the page.

Everything works fine, but when I go to write something from the textview the keyboard appears and the bar disappears from the view because it drags over.

I tried various systems to try to insert the scoolview and keep the bar fixed at the top.

I used both the scrollview and the NestedScrollView and I also changed the bar created with the RelativeLayout to a toolbar. but the content of the LinearLayout with the weightSum stretches a lot.

do you have any suggestion for me?

thank you

<?xml version="1.0" encoding="utf-8"?>
  <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/fond"
android:fillViewport="true"
tools:context=".client.FicheClient">

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


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_gravity="center|top"
        android:gravity="center|top">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:background="@color/surface_l"
            android:orientation="horizontal"
            android:paddingLeft="56dp"
            android:paddingRight="56dp">

            <TextView
                android:id="@+id/txtNomFichier"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="12dp"
                android:ellipsize="end"
                android:fontFamily="@font/inter_bold_700t"
                android:gravity="center_horizontal"
                android:maxLines="1"
                android:text="@string/label_document"
                android:textColor="@color/white"
                android:textSize="14sp" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:onClick="backList"
            android:paddingStart="16dp"
            android:paddingTop="12dp"
            android:paddingEnd="16dp"
            android:paddingBottom="12dp">

            <ImageView
                android:id="@+id/btn_Back"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/icone_arrow_left_blanc" />

        </LinearLayout>


        <Button
            android:id="@+id/btn_share"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_alignParentEnd="true"
            android:layout_marginTop="12dp"
            android:layout_marginEnd="16dp"
            android:background="@drawable/fond_partage"
            android:fontFamily="@font/inter_regular_400t"
            android:onClick="launchPartage"
            android:text=""
            android:textColor="@color/blanc"
            android:visibility="invisible" />

        <ProgressBar
            android:id="@+id/progressBarTop"
            style="?android:attr/progressBarStyle"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_alignParentEnd="true"
            android:layout_marginTop="12dp"
            android:layout_marginEnd="16dp"
            android:theme="@style/colorProgressBarTop" />

    </RelativeLayout>

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

        <LinearLayout
            android:layout_margin="16dp"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="77"
            android:background="@drawable/radius_gris"
            android:orientation="vertical">

            <ImageView
                android:layout_gravity="center_horizontal|center_vertical"
                android:id="@+id/imageView"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <com.github.barteksc.pdfviewer.PDFView
                android:layout_gravity="center_horizontal|center_vertical"
                android:id="@+id/pdfView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="gone" />
        </LinearLayout>

        <LinearLayout
            android:layout_weight="11"
            android:layout_marginRight="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginBottom="16dp"
            android:padding="12sp"
            android:background="@drawable/radius_blanc"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:gravity="center_vertical"
            android:orientation="vertical">

            <TextView
                android:id="@+id/txtLibelleNomFichier"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fontFamily="@font/inter_regular_400t"
                android:gravity="left|center_vertical"
                android:text="@string/label_file_name_obligatoire"
                android:textColor="@color/surface_h"
                android:textSize="12sp" />

            <EditText
                android:id="@+id/txtNom"
                android:layout_width="match_parent"
                android:layout_height="18dp"
                android:background="@drawable/textedit_blanc_rounded_corners"
                android:textColor="@color/surface_k"
                android:ellipsize="end"
                android:textSize="12sp"
                android:fontFamily="@font/inter_semi_bold_600t"
                android:gravity="left|center_vertical"
                android:inputType="text"
                android:maxLines="1"
                android:layout_marginTop="2dp"
                android:scrollHorizontally="true" />

        </LinearLayout>


        <LinearLayout
            android:background="@color/blanc"
            android:layout_weight="12"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:gravity="center"
            android:orientation="vertical">

            <Button
                android:id="@+id/btn_upload"
                android:layout_width="match_parent"
                android:layout_height="39dp"
                android:layout_columnWeight="1"
                android:layout_margin="16dp"
                android:textAllCaps="false"
                android:background="@drawable/radius_primary_5"
                android:text="@string/btn_validate"
                android:textColor="@color/blanc" />

        </LinearLayout>

    </LinearLayout>

</LinearLayout>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

enter image description here

enter image description here

Kevin
  • 415
  • 3
  • 8
  • 21

0 Answers0