skip to Main Content

I created an xml file where I create data input, but the ScrollView does not scroll until the end and some data is behind the screen.
here is a sample code
I also added an image below how it looks, I’ve been sitting for two hours and I can’t figure out what’s wrong

  <?xml version="1.0" encoding="utf-8"?>
       <androidx.constraintlayout.widget.ConstraintLayout                 
       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"
     xmlns:card_view="http://schemas.android.com/apk/res-auto"
      tools:context=".MainActivity">

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


        <com.google.android.material.card.MaterialCardView
            android:id="@+id/InfoName"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="80dp"
            android:background="@android:color/white"
            app:cardBackgroundColor="@android:color/white"
            app:cardCornerRadius="10dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            card_view:cardElevation="10dp"
            card_view:cardUseCompatPadding="true"
            tools:ignore="MissingConstraints">

            <LinearLayout
                android:id="@+id/form_"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:orientation="vertical"
                android:paddingStart="10dp"
                android:paddingEnd="10dp">

                <ImageView
                    android:id="@+id/imageLogin"
                    android:layout_width="150dp"
                    android:layout_height="150dp"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:srcCompat="@tools:sample/avatars" />

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/form_edu_Name"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    app:errorEnabled="true"
                    app:hintTextAppearance="@android:style/TextAppearance.Medium">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/Full_name"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"

                        android:hint="ФИО" />

                </com.google.android.material.textfield.TextInputLayout>

              

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/form_edu_til_degree"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    app:errorEnabled="true"
                    app:hintTextAppearance="@android:style/TextAppearance.Medium">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/experience"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"

                        android:hint="Опыт работы" />

                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/form_edu_til_university"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:errorEnabled="true"
                    app:hintTextAppearance="@android:style/TextAppearance.Medium">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/contacts"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"

                        android:hint="Контакты" />

                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/form_edu_til_grade"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:errorEnabled="true"
                    app:hintTextAppearance="@android:style/TextAppearance.Medium">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/skills"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"

                        android:hint="Навыки" />

                </com.google.android.material.textfield.TextInputLayout>

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/form_dop_info"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:errorEnabled="true"
                    app:hintTextAppearance="@android:style/TextAppearance.Medium">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/dop_info"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:hint="Дополнительная информация" />

                </com.google.android.material.textfield.TextInputLayout>

            

                <com.google.android.material.textfield.TextInputLayout
                    android:id="@+id/form_edu_portfolio"
                    style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:errorEnabled="true"
                    app:hintTextAppearance="@android:style/TextAppearance.Medium">

                    <com.google.android.material.textfield.TextInputEditText
                        android:id="@+id/portfolio"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:hint="Портфолио" />

                </com.google.android.material.textfield.TextInputLayout>

               

            </LinearLayout>

        </com.google.android.material.card.MaterialCardView>

    </ScrollView>




</androidx.constraintlayout.widget.ConstraintLayout>

xml file
image phone

I think it has something to do with ScrollView MaterialCardView
I don’t know how to remove and fix it I need it all worked fine

2

Answers


  1. You should define a MasterCard as the parent element. Inside the MasterCard, you should define a ScrollView as its child element. Then, within the ScrollView, define a LinearLayout as its child element. Finally, inside the LinearLayout, define the remaining ImageView and other content, such as TextViews

    Login or Signup to reply.
  2. code:

    <com.google.android.material.card.MaterialCardView xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/InfoName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="80dp"
        android:background="@android:color/white"
        app:cardBackgroundColor="@android:color/white"
        app:cardCornerRadius="10dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:cardElevation="10dp"
        app:cardUseCompatPadding="true"
        tools:ignore="MissingConstraints">
    
        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="wrap_content">
    
    
                <LinearLayout
                    android:id="@+id/form_"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:gravity="center_horizontal"
                    android:orientation="vertical"
                    android:paddingStart="10dp"
                    android:paddingEnd="10dp">
    
    
    
                    <ImageView
                        android:id="@+id/imageLogin"
                        android:layout_width="150dp"
                        android:layout_height="150dp"
                        app:layout_constraintEnd_toEndOf="parent"
                        app:layout_constraintStart_toStartOf="parent"
                        app:layout_constraintTop_toTopOf="parent"
                        tools:srcCompat="@tools:sample/avatars" />
    
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/form_edu_Name"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_marginTop="10dp"
                        app:errorEnabled="true"
                        app:hintTextAppearance="@android:style/TextAppearance.Medium">
    
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/Full_name"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
    
                            android:hint="ФИО" />
    
                    </com.google.android.material.textfield.TextInputLayout>
    
    
    
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/form_edu_til_degree"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="10dp"
                        app:errorEnabled="true"
                        app:hintTextAppearance="@android:style/TextAppearance.Medium">
    
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/experience"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
    
                            android:hint="1" />
    
                    </com.google.android.material.textfield.TextInputLayout>
    
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/form_edu_til_university"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:errorEnabled="true"
                        app:hintTextAppearance="@android:style/TextAppearance.Medium">
    
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/contacts"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
    
                            android:hint="2" />
    
                    </com.google.android.material.textfield.TextInputLayout>
    
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/form_edu_til_grade"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:errorEnabled="true"
                        app:hintTextAppearance="@android:style/TextAppearance.Medium">
    
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/skills"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
    
                            android:hint="3" />
    
                    </com.google.android.material.textfield.TextInputLayout>
    
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/form_dop_info"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:errorEnabled="true"
                        app:hintTextAppearance="@android:style/TextAppearance.Medium">
    
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/dop_info"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:hint="4" />
    
                    </com.google.android.material.textfield.TextInputLayout>
    
    
    
                    <com.google.android.material.textfield.TextInputLayout
                        android:id="@+id/form_edu_portfolio"
                        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        app:errorEnabled="true"
                        app:hintTextAppearance="@android:style/TextAppearance.Medium">
    
                        <com.google.android.material.textfield.TextInputEditText
                            android:id="@+id/portfolio"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:hint="5" />
    
                    </com.google.android.material.textfield.TextInputLayout>
    
    
    
                </LinearLayout>
        </ScrollView>
    </com.google.android.material.card.MaterialCardView>
    

    output:
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search