Валерия
Валерия

Reputation: 1

I can`t scroll to the end of the page. Android studio

I can`t scroll to the end of the page.

Here`s my xml code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".UploadActivity">
    <ImageButton
        android:id="@+id/uploadButton_close"
        android:layout_width="25dp"
        android:layout_height="26dp"
        android:layout_marginStart="20dp"
        android:layout_marginBottom="84dp"
        android:layout_marginTop="10dp"
        android:background="@android:color/transparent"
        android:scaleType="fitCenter"
        app:srcCompat="@drawable/close_icon" />
            <ScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                >
                <androidx.cardview.widget.CardView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="50dp"
                    android:layout_marginEnd="20dp"
                    android:layout_marginStart="20dp"
                    app:cardCornerRadius="30dp"
                    app:cardElevation="20dp">
                        <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical"
                        android:layout_gravity="center_horizontal"
                            android:padding="20dp"
                        android:background="@drawable/lavender_border">
                        <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="Завантажте дані"
                        android:textSize="30sp"
                        android:textAlignment="center"
                        android:textColor="@color/purple" />
                        <ImageView
                        android:id="@+id/uploadImage"
                        android:layout_width="match_parent"
                        android:layout_height="200dp"
                        android:scaleType="fitCenter"
                        android:src="@drawable/baseline_image_search_24"
                        android:layout_marginTop="10dp"
                        />
                        <EditText
                        android:layout_width="match_parent"
                        android:layout_height="60dp"
                        android:id="@+id/uploadTitle"
                        android:textSize="16sp"
                        android:textStyle="bold"
                        android:background="@drawable/lavender_border"
                        android:hint="Введіть заголовок"
                        android:layout_marginTop="20dp"
                        android:padding="16dp"
                        android:layout_gravity="start|center_vertical"
                        android:textColor="@color/purple"/>
                        <EditText
                        android:layout_width="match_parent"
                        android:layout_height="60dp"
                        android:id="@+id/uploadCaption"
                        android:textSize="14sp"
                        android:background="@drawable/lavender_border"
                        android:hint="Введіть короткий опис"
                        android:layout_marginTop="20dp"
                        android:padding="16dp"
                        android:layout_gravity="start|center_vertical"
                        android:textColor="@color/purple"/>
                    <EditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:id="@+id/uploadText"
                        android:background="@drawable/lavender_border"
                        android:hint="Введіть текст"
                        android:textSize="14sp"
                        android:layout_marginTop="20dp"
                        android:padding="16dp"
                        android:layout_gravity="start|center_vertical"
                        android:textColor="@color/purple"
                        android:inputType="textMultiLine"
                        android:minLines="12"
                        android:gravity="top"
                        />
                        <EditText
                        android:layout_width="match_parent"
                        android:layout_height="60dp"
                        android:id="@+id/uploadLink"
                        android:textSize="14sp"
                        android:background="@drawable/lavender_border"
                        android:hint="Посилання"
                        android:layout_marginTop="20dp"
                        android:padding="16dp"
                        android:layout_gravity="start|center_vertical"
                        android:textColor="@color/purple"/>
                        <AutoCompleteTextView
                            android:id="@+id/uploadTheme"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_gravity="start|center_vertical"
                            android:layout_marginTop="20dp"
                            android:background="@drawable/lavender_border"
                            android:hint="Оберіть тему"
                            android:inputType="none"
                            android:padding="16dp"
                            android:textColor="@color/purple"
                            android:textSize="14sp"
                            tools:ignore="SpeakableTextPresentCheck"
                            android:drawableEnd="@drawable/baseline_arrow_drop_down_24"/>
                        <Button
                        android:layout_width="match_parent"
                        android:layout_height="60dp"
                         android:text="Зберегти"
                        android:id="@+id/uploadButton_save"
                        android:textSize="18sp"
                        android:layout_marginTop="10dp"
                            />

        </LinearLayout>

    </androidx.cardview.widget.CardView>

</ScrollView>
</RelativeLayout>

How to fix it? Thanks for responds.

I tried to add more margin_bottom but it doesn`t work, also i deleted it, tried to add padding and etc. half the button is not visible If i add margin_bottom to LinearLayout, CardView goes beyond CardView goes beyond when in LinearLayout margin_bottom=50dp If i add margin_bottom to CardView, nothing happen. I also tried change layout heights on match_parent/wrap_content but nothing helped.

Upvotes: 0

Views: 27

Answers (1)

RH201
RH201

Reputation: 331

Remove the padding from your LinearLayout and the button will no longer be cutoff at the bottom. Delete this: android:padding="20dp"

You are filling the screen with the heights of all your other views, you have no room for padding.

Upvotes: 0

Related Questions