Unable to place a textview or any object under half of a screen
<?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"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</com.google.android.material.appbar.AppBarLayout>
<include layout="#layout/content_main" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/gender"
android:layout_width="96dp"
android:layout_height="49dp"
android:layout_gravity="center"
android:paddingTop="30dp"
android:text="GENDER"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/holo_red_dark"
android:textStyle="bold|italic"
android:typeface="serif"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.295"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.102" />
<TextView
android:id="#+id/tv4"
android:layout_width="96dp"
android:layout_height="49dp"
android:layout_gravity="center"
android:layout_marginTop="116dp"
android:paddingTop="30dp"
android:text="HEIGHT"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/holo_red_dark"
android:textStyle="bold|italic"
android:typeface="serif"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.295"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<org.angmarch.views.NiceSpinner
android:id="#+id/weight_spinner"
android:layout_width="148dp"
android:layout_height="52dp"
android:layout_marginBottom="12dp"
app:layout_constraintBottom_toTopOf="#+id/weight_et"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.222"
app:layout_constraintStart_toEndOf="#+id/tv3" />
<EditText
android:id="#+id/weight_et"
android:layout_width="139dp"
android:layout_height="38dp"
android:layout_gravity="center"
android:layout_marginTop="28dp"
android:ems="10"
android:fadingEdgeLength="10dp"
android:hint="Enter Weight"
android:inputType="numberDecimal"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.283"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv3" />
<TextView
android:id="#+id/tv3"
android:layout_width="107dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:paddingTop="30dp"
android:text="WEIGHT"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/holo_red_dark"
android:textStyle="bold|italic"
android:typeface="serif"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.305"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/height_et" />
<Button
android:id="#+id/ib1"
android:layout_width="158dp"
android:layout_height="51dp"
android:layout_gravity="center"
android:layout_marginTop="28dp"
android:background="#android:color/holo_blue_dark"
android:capitalize="words"
android:fadingEdge="vertical"
android:longClickable="true"
android:text="Calculate"
android:textColor="#android:color/holo_green_light"
android:textStyle="bold|italic"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weight_et" />
<org.angmarch.views.NiceSpinner
android:id="#+id/height_spinner"
android:layout_width="148dp"
android:layout_height="54dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toTopOf="#+id/height_et"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.148"
app:layout_constraintStart_toEndOf="#+id/tv4" />
<EditText
android:id="#+id/height_et"
android:layout_width="137dp"
android:layout_height="43dp"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:ems="10"
android:hint="Enter Height"
android:inputType="numberDecimal"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.281"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv4"/>
<TextView
android:id="#+id/result_tv"
android:layout_width="200dp"
android:layout_height="66dp"
android:layout_gravity="center"
android:paddingTop="20dp"
android:text=""
android:textAlignment="center"
android:textColor="#android:color/holo_orange_dark"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.027"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ib1"
app:layout_constraintVertical_bias="1.0" />
<EditText
android:id="#+id/ft_in_et"
android:layout_width="158dp"
android:layout_height="44dp"
android:layout_marginBottom="20dp"
android:ems="10"
android:hint=""
android:inputType="numberDecimal"
android:textAlignment="center"
android:visibility="gone"
android:enabled="false"
app:layout_constraintBottom_toTopOf="#+id/weight_spinner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.27"
app:layout_constraintStart_toEndOf="#+id/height_et" />
<EditText
android:id="#+id/st_lb_et"
android:layout_width="149dp"
android:layout_height="41dp"
android:ems="10"
android:hint="lb"
android:inputType="numberDecimal"
android:textAlignment="center"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="#+id/ib1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.076"
app:layout_constraintStart_toEndOf="#+id/weight_et" />
<TextView
android:id="#+id/ideal_weight"
android:layout_width="171dp"
android:layout_height="64dp"
android:gravity="center"
android:text=""
android:textAlignment="center"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.982"
app:layout_constraintStart_toStartOf="#+id/result_tv" />
<org.angmarch.views.NiceSpinner
android:id="#+id/gender_spinner"
android:layout_width="187dp"
android:layout_height="50dp"
app:layout_constraintBottom_toTopOf="#+id/tv4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.982"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:adSize="BANNER"
app:adUnitId="ca-app-pub-3940256099942544/6300978111"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"></com.google.android.gms.ads.AdView>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="#dimen/fab_margin"
app:backgroundTint="#009688"
app:srcCompat="#drawable/ic_reset" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
As you can see in the image that half of the screen is uneditable
As you can see in the image that half of the screen is uneditable
As you can see in the image that half of the screen is uneditable
[Here is an image of layout]
https://i.stack.imgur.com/OKygh.jpg
Problem is inside of your ConstraintLayout. You use wrong constraints.
Fixed Some:
<?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"
tools:context=".MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
</com.google.android.material.appbar.AppBarLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/gender"
android:layout_width="96dp"
android:layout_height="49dp"
android:layout_gravity="center"
android:paddingTop="30dp"
android:text="GENDER"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/holo_red_dark"
android:textStyle="bold|italic"
android:typeface="serif"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.295"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.102" />
<TextView
android:id="#+id/tv4"
android:layout_width="96dp"
android:layout_height="49dp"
android:layout_gravity="center"
android:layout_marginTop="116dp"
android:paddingTop="30dp"
android:text="HEIGHT"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/holo_red_dark"
android:textStyle="bold|italic"
android:typeface="serif"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.295"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<org.angmarch.views.NiceSpinner
android:id="#+id/weight_spinner"
android:layout_width="148dp"
android:layout_height="52dp"
android:layout_marginBottom="12dp"
app:layout_constraintBottom_toTopOf="#+id/weight_et"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.222"
app:layout_constraintStart_toEndOf="#+id/tv3" />
<EditText
android:id="#+id/weight_et"
android:layout_width="139dp"
android:layout_height="38dp"
android:layout_gravity="center"
android:layout_marginTop="28dp"
android:ems="10"
android:fadingEdgeLength="10dp"
android:hint="Enter Weight"
android:inputType="numberDecimal"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.283"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv3" />
<TextView
android:id="#+id/tv3"
android:layout_width="107dp"
android:layout_height="55dp"
android:layout_gravity="center"
android:paddingTop="30dp"
android:text="WEIGHT"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/holo_red_dark"
android:textStyle="bold|italic"
android:typeface="serif"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.305"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/height_et" />
<Button
android:id="#+id/ib1"
android:layout_width="158dp"
android:layout_height="51dp"
android:layout_gravity="center"
android:layout_marginTop="28dp"
android:background="#android:color/holo_blue_dark"
android:capitalize="words"
android:fadingEdge="vertical"
android:longClickable="true"
android:text="Calculate"
android:textColor="#android:color/holo_green_light"
android:textStyle="bold|italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/weight_et" />
<org.angmarch.views.NiceSpinner
android:id="#+id/height_spinner"
android:layout_width="148dp"
android:layout_height="54dp"
android:layout_marginBottom="16dp"
app:layout_constraintBottom_toTopOf="#+id/height_et"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.148"
app:layout_constraintStart_toEndOf="#+id/tv4" />
<EditText
android:id="#+id/height_et"
android:layout_width="137dp"
android:layout_height="43dp"
android:layout_gravity="center"
android:layout_marginTop="32dp"
android:ems="10"
android:hint="Enter Height"
android:inputType="numberDecimal"
android:textAlignment="center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.281"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/tv4"/>
<TextView
android:id="#+id/result_tv"
android:layout_width="200dp"
android:layout_height="66dp"
android:layout_gravity="center"
android:paddingTop="20dp"
android:text="Result"
android:textAlignment="center"
android:textColor="#android:color/holo_orange_dark"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.027"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/ib1"
app:layout_constraintVertical_bias="1.0" />
<EditText
android:id="#+id/ft_in_et"
android:layout_width="158dp"
android:layout_height="44dp"
android:layout_marginBottom="20dp"
android:ems="10"
android:hint="lb"
android:inputType="numberDecimal"
android:textAlignment="center"
android:enabled="false"
app:layout_constraintBottom_toTopOf="#+id/weight_spinner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.27"
app:layout_constraintStart_toEndOf="#+id/height_et" />
<EditText
android:id="#+id/st_lb_et"
android:layout_width="149dp"
android:layout_height="41dp"
android:ems="10"
android:hint="lb"
android:inputType="numberDecimal"
android:textAlignment="center"
app:layout_constraintTop_toBottomOf="#+id/weight_spinner"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.076"
app:layout_constraintStart_toEndOf="#+id/weight_et" />
<TextView
android:id="#+id/ideal_weight"
android:layout_width="171dp"
android:layout_height="64dp"
android:gravity="center"
android:text=""
android:textAlignment="center"
android:textSize="20dp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="#+id/adView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.982"
app:layout_constraintStart_toStartOf="#+id/result_tv" />
<org.angmarch.views.NiceSpinner
android:id="#+id/gender_spinner"
android:layout_width="187dp"
android:layout_height="50dp"
app:layout_constraintBottom_toTopOf="#+id/tv4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.982"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:adSize="BANNER"
app:adUnitId="ca-app-pub-3940256099942544/6300978111"
app:layout_constraintTop_toBottomOf="#+id/result_tv"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:backgroundTint="#009688"
app:srcCompat="#android:drawable/ic_menu_search" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Output:
Hi please add fillViewport as true in scrollview.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"/>
Related
I'm new to working with android layout, I'm building a form app but all my text widgets, dropdowns, and edit text are moving to the left can anyone tell what's wrong?
PS: Code will be appreciated
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="40dp"
tools:context=".MainActivity">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="159dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="126dp"
android:text="ERDI"
android:textColor="#000000"
android:textSize="40sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Spinner
android:id="#+id/spinner3"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginStart="56dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="61dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView5" />
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="58dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="208dp"
android:text="Spectre Shape"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/spinner3" />
<TextView
android:id="#+id/textView4"
android:layout_width="136dp"
android:layout_height="21dp"
android:layout_marginStart="56dp"
android:layout_marginTop="108dp"
android:layout_marginEnd="179dp"
android:gravity="right"
android:text="Collateral Damage"
android:textAlignment="gravity"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView2" />
<Spinner
android:id="#+id/spinner5"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginStart="56dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="61dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView4" />
<TextView
android:id="#+id/textView5"
android:layout_width="118dp"
android:layout_height="25dp"
android:layout_marginStart="56dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="196dp"
android:text="Ground Shaking"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/spinner2" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="128dp"
android:layout_marginEnd="238dp"
android:text="Hazard"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="#+id/editTextTextPersonName4"
android:layout_width="252dp"
android:layout_height="46dp"
android:layout_marginStart="56dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="63dp"
android:ems="10"
android:hint="Enter the Height..."
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView18" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="229dp"
android:text="Zone Factor"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/spinner5" />
<Spinner
android:id="#+id/spinner2"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginStart="56dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="61dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView3" />
<Spinner
android:id="#+id/spinner4"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginStart="56dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="61dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView8" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="148dp"
android:text="FSI (Floor Space Index)"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/spinner4" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="72dp"
android:layout_marginEnd="215dp"
android:text="Exposure"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/editTextTextPersonName4" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="224dp"
android:text="Importance I"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView7" />
<EditText
android:id="#+id/editTextTextPersonName2"
android:layout_width="255dp"
android:layout_height="47dp"
android:layout_marginStart="56dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="60dp"
android:ems="10"
android:hint="Enter the FSI..."
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView10" />
<Spinner
android:id="#+id/spinner7"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginStart="56dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="61dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView13" />
<Spinner
android:id="#+id/spinner6"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginStart="56dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="61dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView12" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="12dp"
android:layout_marginEnd="89dp"
android:text="Economic Loss Inducing Factors"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/spinner6" />
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="56dp"
android:layout_marginTop="48dp"
android:layout_marginEnd="139dp"
android:text="Life Threatening Factors"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/textView11" />
<Button
android:id="#+id/postdataBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="147dp"
android:layout_marginTop="108dp"
android:layout_marginEnd="133dp"
android:text="SUBMIT"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/spinner7" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="127dp"
android:layout_marginTop="80dp"
android:layout_marginEnd="108dp"
android:text="Vulnerability"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/editTextTextPersonName2" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
I'm using constraint layout inside Scroll View layout, I tried various text alignment, widget alignment but the layout still remains to align left.
I Have Used Linear Layout And Updated Your Code to look like a form
If it Helps Accept My Answer !!
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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">
<androidx.appcompat.widget.LinearLayoutCompat
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="40dp"
android:gravity="start"
tools:context=".MainActivity">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ERDI"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold"
/>
<Spinner
android:id="#+id/spinner3"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="61dp"/>
<TextView
android:id="#+id/textView18"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Spectre Shape"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/textView4"
android:layout_width="136dp"
android:layout_height="21dp"
android:layout_marginTop="20dp"
android:gravity="right"
android:text="Collateral Damage"
android:textAlignment="gravity"
android:textSize="16sp"
android:textStyle="bold"/>
<Spinner
android:id="#+id/spinner5"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="61dp"/>
<TextView
android:id="#+id/textView5"
android:layout_width="118dp"
android:layout_height="25dp"
android:layout_marginTop="24dp"
android:text="Ground Shaking"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Hazard"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold"/>
<EditText
android:id="#+id/editTextTextPersonName4"
android:layout_width="252dp"
android:layout_height="46dp"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="Enter the Height..."
android:inputType="textPersonName"/>
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Zone Factor"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"/>
<Spinner
android:id="#+id/spinner2"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginTop="20dp"/>
<Spinner
android:id="#+id/spinner4"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginTop="20dp"/>
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:text="FSI (Floor Space Index)"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Exposure"
android:textColor="#000000"
android:textSize="20sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:text="Importance I"
android:textSize="16sp"
android:textStyle="bold"/>
<EditText
android:id="#+id/editTextTextPersonName2"
android:layout_width="255dp"
android:layout_height="47dp"
android:layout_marginTop="20dp"
android:ems="10"
android:hint="Enter the FSI..."
android:inputType="textPersonName"/>
<Spinner
android:id="#+id/spinner7"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginTop="12dp"/>
<Spinner
android:id="#+id/spinner6"
android:layout_width="254dp"
android:layout_height="41dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="61dp"/>
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="Economic Loss Inducing Factors"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/textView12"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Life Threatening Factors"
android:textAlignment="textEnd"
android:textSize="16sp"
android:textStyle="bold"/>
<Button
android:id="#+id/postdataBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="108dp"
android:text="SUBMIT"
android:layout_gravity="center" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="80dp"
android:text="Vulnerability"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold"/>
</androidx.appcompat.widget.LinearLayoutCompat>
</ScrollView>
What I would suggest you to do is to fit everything into a Linear Layout, like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
your code here
</ScrollView>
</LinearLayout>
Also, as someone said in your comments, you should, inside of the ScrollView, use LinearLayout with vertical alignment, and then use proper paddings and margins in order to make the UI look good. You can use gravity and layout-gravity to align every element you want.
I am working on an application, with following XML.
This the XML of my Sign In Fragment.
But when I try to clean/build my project the following error occurs:
error: Error parsing XML: not well-formed (invalid token)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".SignInFragment"
android:background="#drawable/gradient_color">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/sign_up_close_btn"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="#android:color/transparent"
android:padding="16dp"
android:src="#drawable/ic_cancel"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="#+id/imageView"
android:layout_width="254dp"
android:layout_height="182dp"
android:src="#mipmap/ic_launcher_foreground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.16000003" />
<EditText
android:id="#+id/sign_in_email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:backgroundTint="#70FFFFFF"
android:textColor="#color/colorAccent"
android:ems="10"
android:hint="#string/hint_email"
android:inputType="textEmailAddress"
android:textColorHint="#70FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/imageView" />
<EditText
android:id="#+id/sign_in_pass"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:backgroundTint="#70FFFFFF"
android:textColor="#color/colorAccent"
android:ems="10"
android:hint="#string/hint_pass"
android:inputType="textPassword"
android:textColorHint="#70FFFFFF"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/sign_in_email" />
<TextView
android:id="#+id/sign_in_forgot_pass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginLeft="4dp"
android:text="#string/forg_pass"
android:textColor="#color/colorAccent"
app:layout_constraintStart_toStartOf="#+id/sign_in_pass"
app:layout_constraintTop_toBottomOf="#+id/sign_in_pass" />
<Button
android:id="#+id/sign_in_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:background="#color/colorPrimary"
android:text="#string/btn_In"
android:textAllCaps="false"
android:textColor="#color/colorAccent"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/sign_in_forgot_pass"
app:layout_constraintVertical_bias="0.47000003" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/or"
android:textColor="#color/colorAccent"
app:layout_constraintBottom_toTopOf="#+id/tv_dont_have_an_account"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/sign_in_btn"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="#+id/tv_dont_have_an_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="#string/text1"
android:textColor="#color/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<View
android:id="#+id/divider"
android:layout_width="100dp"
android:layout_height="1dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:background="#color/colorAccent"
app:layout_constraintBottom_toBottomOf="#+id/textView2"
app:layout_constraintEnd_toStartOf="#+id/textView2"
app:layout_constraintTop_toTopOf="#+id/textView2" />
<View
android:id="#+id/divider2"
android:layout_width="100dp"
android:layout_height="1dp"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:background="#color/colorAccent"
app:layout_constraintBottom_toBottomOf="#+id/textView2"
app:layout_constraintStart_toEndOf="#+id/textView2"
app:layout_constraintTop_toTopOf="#+id/textView2" />
<ProgressBar
android:id="#+id/sign_in_progress_bar"
style="?android:attr/progressBarStyle"
android:layout_width="30dp"
android:layout_height="30dp"
android:visibility="invisible"
app:layout_constraintBottom_toTopOf="#+id/sign_in_btn"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/sign_in_pass" />
</>
</FrameLayout>
What does it possibly mean? what i have done wrong?
I'm really worried about this. i have go through my code many time but didn't find the error
The second-to-last line of your file has
</>
which causes your XML file to be not well-formed. Change it to
</androidx.constraintlayout.widget.ConstraintLayout>
to properly close a previous opening tag of the same name.
I am a beginner in native android programming. Would like to seek some guidance and help to get rid of this gap in between the toolbar and my recycler view. Read through some write-ups on people who faced the same issue but majority of these had included a "Coordinator Layout" or "layout_gravity". However, I did not have those in my code. Tried many other ways but couldn't make it work.
Here is a picture that is based on the code! The embedded picture shows a better contrast for the gap. Sorry my account doesn't allow any embedding of photos yet.
Here is my code for the parent recycler view.
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/rvProfile"
android:layout_width="403dp"
android:layout_height="match_parent"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp" />
Here is the code for my individual item layout.
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/profileImage"
android:layout_width="111dp"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="29dp"
android:background="#drawable/profile"></ImageView>
<TextView
android:id="#+id/profileUserName"
android:layout_width="wrap_content"
android:layout_height="29dp"
android:layout_alignParentTop="true"
android:layout_marginStart="4dp"
android:layout_marginTop="1dp"
android:layout_toEndOf="#+id/profileImage"
android:text="User Name"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"></TextView>
<Button
android:id="#+id/changeProfilePicture"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_below="#+id/profileUserName"
android:layout_marginStart="4dp"
android:layout_marginTop="8dp"
android:layout_toEndOf="#+id/profileImage"
android:background="#color/zxing_transparent"
android:text="Change Profile Picture"
android:textAllCaps="false"
android:textColor="#color/textColorLight"
android:textSize="20sp"
android:textStyle="normal"></Button>
<Button
android:id="#+id/changePasswordBtn"
android:layout_width="wrap_content"
android:layout_height="23dp"
android:layout_below="#+id/changeProfilePicture"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:layout_toEndOf="#+id/profileImage"
android:background="#color/zxing_transparent"
android:text="Change Password"
android:textAllCaps="false"
android:textColor="#color/textColorLight"
android:textSize="20sp"
android:textStyle="normal"></Button>
<TextView
android:id="#+id/accountbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/profileImage"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="1dp"
android:layout_marginTop="-1dp"
android:layout_marginEnd="0dp"
android:background="#color/primarylighest"
android:padding="5dp"
android:paddingStart="30dp"
android:text="Account"
android:textColor="#color/colorPrimary"
android:textSize="25sp" />
<TextView
android:id="#+id/pointsTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/accountbar"
android:layout_alignParentStart="true"
android:layout_marginStart="35dp"
android:layout_marginTop="4dp"
android:text="Points"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"></TextView>
<TextView
android:id="#+id/pointsDisplay"
android:layout_width="157dp"
android:layout_height="wrap_content"
android:layout_below="#+id/accountbar"
android:layout_marginStart="131dp"
android:layout_marginTop="6dp"
android:layout_toEndOf="#+id/pointsTxt"
android:text="42 Points"
android:textColor="#color/textColorLight"
android:textSize="20sp"></TextView>
<TextView
android:id="#+id/orderHistoryTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/pointsTxt"
android:layout_alignParentStart="true"
android:layout_marginStart="35dp"
android:layout_marginTop="0dp"
android:text="Order History"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"></TextView>
<Button
android:id="#+id/orderHistBtn"
android:layout_width="33dp"
android:layout_height="28dp"
android:layout_below="#+id/pointsDisplay"
android:layout_alignParentEnd="true"
android:layout_marginStart="178dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="15dp"
android:layout_toEndOf="#+id/orderHistoryTxt"
android:background="#drawable/profile_back"
android:rotation="180"></Button>
<TextView
android:id="#+id/txtExpenseTracker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/orderHistoryTxt"
android:layout_alignParentStart="true"
android:layout_marginStart="35dp"
android:layout_marginTop="1dp"
android:text="Expense Tracker"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"></TextView>
<Button
android:layout_width="32dp"
android:layout_height="31dp"
android:layout_below="#+id/pointsDisplay"
android:layout_alignParentEnd="true"
android:layout_marginStart="141dp"
android:layout_marginTop="44dp"
android:layout_marginEnd="16dp"
android:layout_toEndOf="#+id/txtExpenseTracker"
android:background="#drawable/profile_back"
android:rotation="180"></Button>
<TextView
android:id="#+id/txtCurrencyConvertor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/orderHistoryTxt"
android:layout_alignParentStart="true"
android:layout_marginStart="35dp"
android:layout_marginTop="37dp"
android:text="Currency Convertor"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"></TextView>
<Button
android:layout_width="30dp"
android:layout_height="24dp"
android:layout_below="#+id/pointsDisplay"
android:layout_alignParentEnd="true"
android:layout_marginStart="176dp"
android:layout_marginTop="210dp"
android:layout_marginEnd="16dp"
android:layout_toEndOf="#+id/txtPrivacyPolicy"
android:background="#drawable/profile_back"
android:rotation="180"></Button>
<TextView
android:id="#+id/othersbar"
android:layout_width="410dp"
android:layout_height="46dp"
android:layout_below="#+id/profileImage"
android:layout_alignParentStart="true"
android:layout_alignParentEnd="true"
android:layout_marginStart="1dp"
android:layout_marginTop="206dp"
android:layout_marginEnd="0dp"
android:background="#color/primarylighest"
android:padding="5dp"
android:paddingStart="30dp"
android:text="Others"
android:textColor="#color/colorPrimary"
android:textSize="25sp" />
<TextView
android:id="#+id/txtShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/orderHistoryTxt"
android:layout_alignParentStart="true"
android:layout_marginStart="35dp"
android:layout_marginTop="140dp"
android:text="Share Krysjay with friends"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"></TextView>
<Button
android:layout_width="32dp"
android:layout_height="31dp"
android:layout_below="#+id/othersbar"
android:layout_alignParentEnd="true"
android:layout_marginStart="37dp"
android:layout_marginTop="2dp"
android:layout_marginEnd="16dp"
android:layout_toEndOf="#+id/txtShare"
android:background="#drawable/profile_back"
android:rotation="180"></Button>
<TextView
android:id="#+id/txtPrivacyPolicy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/orderHistoryTxt"
android:layout_alignParentStart="true"
android:layout_marginStart="35dp"
android:layout_marginTop="172dp"
android:text="Privacy Policy"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"></TextView>
<Button
android:layout_width="32dp"
android:layout_height="31dp"
android:layout_below="#+id/othersbar"
android:layout_alignParentEnd="true"
android:layout_marginStart="110dp"
android:layout_marginTop="-97dp"
android:layout_marginEnd="15dp"
android:layout_toEndOf="#+id/txtCurrencyConvertor"
android:background="#drawable/profile_back"
android:rotation="180"></Button>
<TextView
android:id="#+id/txtTermsCons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/orderHistoryTxt"
android:layout_alignParentStart="true"
android:layout_marginStart="35dp"
android:layout_marginTop="205dp"
android:text="Terms & Conditions"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"></TextView>
<Button
android:layout_width="32dp"
android:layout_height="31dp"
android:layout_below="#+id/othersbar"
android:layout_alignParentEnd="true"
android:layout_marginStart="105dp"
android:layout_marginTop="66dp"
android:layout_marginEnd="17dp"
android:layout_toEndOf="#+id/txtTermsCons"
android:background="#drawable/profile_back"
android:rotation="180"></Button>
<Button
android:id="#+id/signOutBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txtPrivacyPolicy"
android:layout_alignParentStart="true"
android:layout_marginStart="0dp"
android:layout_marginTop="27dp"
android:layout_marginBottom="132dp"
android:background="#color/zxing_transparent"
android:outlineAmbientShadowColor="#color/colorPrimaryDark"
android:paddingStart="30dp"
android:text="Sign Out"
android:textAlignment="textStart"
android:textAllCaps="false"
android:textColor="#color/colorPrimary"
android:textSize="25sp" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Have you tried to remove this line of code from your imageView?
android:layout_marginTop="67dp"
<RelativeLayout
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">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/profileImage"
android:layout_width="111dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:background="#drawable/profile"></ImageView>
<TextView
android:id="#+id/accountbar"
android:layout_width="410dp"
android:layout_height="46dp"
android:background="#color/primarylighest"
android:padding="5dp"
android:paddingStart="30dp"
android:text="Account"
android:textColor="#color/colorPrimary"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/profileImage"/>
<TextView
android:id="#+id/profileUserName"
android:layout_width="wrap_content"
android:layout_height="29dp"
android:text="User Name"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="#id/accountbar"
app:layout_constraintTop_toBottomOf="#id/profileImage"></TextView>
<Button
android:id="#+id/changeProfilePicture"
android:layout_width="wrap_content"
android:layout_height="25dp"
android:layout_marginStart="4dp"
android:background="#color/zxing_transparent"
android:text="Change Profile Picture"
android:textAllCaps="false"
android:textColor="#color/textColorLight"
android:textSize="20sp"
android:textStyle="normal"
app:layout_constraintEnd_toStartOf="#id/pointsDisplay"
app:layout_constraintHorizontal_bias="0.516"
app:layout_constraintStart_toEndOf="#id/pointsTxt"
app:layout_constraintTop_toBottomOf="#id/accountbar"></Button>
<Button
android:id="#+id/changePasswordBtn"
android:layout_width="wrap_content"
android:layout_height="23dp"
android:layout_marginStart="6dp"
android:layout_marginTop="6dp"
android:background="#color/zxing_transparent"
android:text="Change Password"
android:textAllCaps="false"
android:textColor="#color/textColorLight"
android:textSize="20sp"
android:textStyle="normal"
app:layout_constraintEnd_toStartOf="#id/pointsDisplay"
app:layout_constraintStart_toEndOf="#id/pointsTxt"
app:layout_constraintTop_toBottomOf="#id/changeProfilePicture"></Button>
<TextView
android:id="#+id/pointsTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginTop="8dp"
android:text="Points"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/accountbar"></TextView>
<TextView
android:id="#+id/pointsDisplay"
android:layout_width="157dp"
android:layout_height="wrap_content"
android:layout_marginStart="131dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:text="42 Points"
android:textColor="#color/textColorLight"
android:textSize="20sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/pointsTxt"
app:layout_constraintTop_toBottomOf="#id/accountbar"></TextView>
<TextView
android:id="#+id/orderHistoryTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginTop="4dp"
android:text="Order History"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/pointsTxt"></TextView>
<Button
android:id="#+id/orderHistBtn"
android:layout_width="33dp"
android:layout_height="28dp"
android:layout_marginEnd="15dp"
android:background="#drawable/profile_back"
android:rotation="180"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#id/orderHistoryTxt"
app:layout_constraintTop_toBottomOf="#id/changePasswordBtn"></Button>
<TextView
android:id="#+id/txtExpenseTracker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginTop="4dp"
android:text="Expense Tracker"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/orderHistoryTxt"></TextView>
<Button
android:id="#+id/btnExpenseTracker"
android:layout_width="32dp"
android:layout_height="31dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="15dp"
android:background="#drawable/profile_back"
android:rotation="180"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#id/txtExpenseTracker"
app:layout_constraintTop_toBottomOf="#id/orderHistBtn"></Button>
<TextView
android:id="#+id/txtCurrencyConvertor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginTop="4dp"
android:text="Currency Convertor"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/txtExpenseTracker"></TextView>
<Button
android:id="#+id/button"
android:layout_width="30dp"
android:layout_height="24dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="15dp"
android:background="#drawable/profile_back"
android:rotation="180"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#id/txtPrivacyPolicy"
app:layout_constraintTop_toBottomOf="#id/btnShareWithFriends"></Button>
<TextView
android:id="#+id/othersbar"
android:layout_width="410dp"
android:layout_height="46dp"
android:layout_marginTop="4dp"
android:background="#color/primarylighest"
android:padding="5dp"
android:paddingStart="30dp"
android:text="Others"
android:textColor="#color/colorPrimary"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/txtCurrencyConvertor" />
<TextView
android:id="#+id/txtShare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginTop="4dp"
android:text="Share Krysjay with friends"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/othersbar"></TextView>
<Button
android:id="#+id/btnShareWithFriends"
android:layout_width="32dp"
android:layout_height="31dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="15dp"
android:background="#drawable/profile_back"
android:rotation="180"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#id/txtShare"
app:layout_constraintTop_toBottomOf="#id/othersbar"></Button>
<TextView
android:id="#+id/txtPrivacyPolicy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginTop="4dp"
android:text="Privacy Policy"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/txtShare"></TextView>
<Button
android:id="#+id/btnCurrencyCovertor"
android:layout_width="32dp"
android:layout_height="31dp"
android:layout_marginTop="4dp"
android:layout_marginEnd="15dp"
android:background="#drawable/profile_back"
android:rotation="180"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#id/txtCurrencyConvertor"
app:layout_constraintTop_toBottomOf="#id/btnExpenseTracker"></Button>
<TextView
android:id="#+id/txtTermsCons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginTop="4dp"
android:text="Terms & Conditions"
android:textColor="#color/colorPrimaryDark"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/txtPrivacyPolicy"></TextView>
<Button
android:id="#+id/btnTermsCond"
android:layout_width="32dp"
android:layout_height="31dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="15dp"
android:background="#drawable/profile_back"
android:rotation="180"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toEndOf="#+id/txtTermsCons"
app:layout_constraintTop_toBottomOf="#+id/button"></Button>
<Button
android:id="#+id/signOutBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="#+id/txtPrivacyPolicy"
android:layout_alignParentStart="true"
android:layout_marginTop="4dp"
android:background="#color/zxing_transparent"
android:outlineAmbientShadowColor="#color/colorPrimaryDark"
android:paddingStart="30dp"
android:text="Sign Out"
android:textAlignment="textStart"
android:textAllCaps="false"
android:textColor="#color/colorPrimary"
android:textSize="25sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#id/txtTermsCons" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
The output of the below code is not coming as the output required . Full Screen is not been covered in the scrollview .I am trying to use Constraint Layout inside the scroll view.Please help.......
The contents of the constraint layout are getting overlaped and the full screen is not covered by constraint layout....
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
xmlns:fancy="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.libizo.CustomEditText
android:id="#+id/Email"
android:layout_width="285dp"
android:layout_height="69dp"
android:ems="10"
android:hint="Email"
android:inputType="textPersonName"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.873"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.111"
app:libIZO_clearIconTint="#8f1f15"
app:libIZO_setBorderColor="#8f1f15"
app:libIZO_setBorderView="true"
app:libIZO_setClearIconVisible="true"
app:libIZO_setCornerRadius="4dp"
app:libIZO_setStrokeWidth="2dp" />
<ImageView
android:id="#+id/icon_mail"
android:layout_width="75dp"
android:layout_height="66dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.047"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.115"
app:srcCompat="#drawable/ic_email"
tools:ignore="ContentDescription,UnusedAttribute,VectorDrawableCompat" />
<mehdi.sakout.fancybuttons.FancyButton
android:id="#+id/Login"
android:layout_width="204dp"
android:layout_height="75dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.417"
fancy:fb_borderColor="#FFFFFF"
fancy:fb_borderWidth="1dp"
fancy:fb_defaultColor="#7ab800"
fancy:fb_focusColor="#9bd823"
fancy:fb_iconPosition="left"
fancy:fb_radius="30dp"
fancy:fb_text="Login / Register"
fancy:fb_textColor="#FFFFFF"
fancy:fb_textSize="25dp" />
<ImageView
android:id="#+id/icon_lock"
android:layout_width="80dp"
android:layout_height="68dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.048"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.268"
app:srcCompat="#drawable/ic_lock"
tools:ignore="ContentDescription,UnusedAttribute,VectorDrawableCompat" />
<com.libizo.CustomEditText
android:id="#+id/Password"
android:layout_width="285dp"
android:layout_height="69dp"
android:ems="10"
android:hint="Password"
android:inputType="textPassword"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.873"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.268"
app:libIZO_clearIconTint="#8f1f15"
app:libIZO_setBorderColor="#8f1f15"
app:libIZO_setBorderView="true"
app:libIZO_setClearIconVisible="true"
app:libIZO_setCornerRadius="4dp"
app:libIZO_setStrokeWidth="2dp" />
<TextView
android:id="#+id/Forgot_Password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot Password ?"
android:textSize="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.527" />
<ProgressBar
android:id="#+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:visibility="gone"/>
<Button
android:id="#+id/Google"
android:layout_width="168dp"
android:layout_height="145dp"
android:background="#drawable/ic_google"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.884"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.725" />
<Button
android:id="#+id/Phone"
android:layout_width="168dp"
android:layout_height="145dp"
android:background="#drawable/ic_phone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.148"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.725" />
<Button
android:id="#+id/Facebook"
android:layout_width="208dp"
android:layout_height="156dp"
android:background="#drawable/ic_facebook"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.541"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.991" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
The Output for the following code is shown here
You set wrong Constraint to view. Try like below. It will give you some idea and change it according your need.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
xmlns:fancy="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:padding="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/icon_mail"
android:layout_width="75dp"
android:layout_height="66dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="#drawable/ic_email"
tools:ignore="ContentDescription,UnusedAttribute,VectorDrawableCompat" />
<com.libizo.CustomEditText
android:id="#+id/Email"
android:layout_width="285dp"
android:layout_height="69dp"
android:ems="10"
android:hint="Email"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:libIZO_clearIconTint="#8f1f15"
app:libIZO_setBorderColor="#8f1f15"
app:libIZO_setBorderView="true"
app:libIZO_setClearIconVisible="true"
app:libIZO_setCornerRadius="4dp"
app:libIZO_setStrokeWidth="2dp" />
<ImageView
android:id="#+id/icon_lock"
android:layout_width="80dp"
android:layout_height="68dp"
android:layout_marginTop="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/icon_mail"
app:srcCompat="#drawable/ic_lock"
tools:ignore="ContentDescription,UnusedAttribute,VectorDrawableCompat" />
<com.libizo.CustomEditText
android:id="#+id/Password"
android:layout_width="285dp"
android:layout_height="69dp"
android:ems="10"
android:hint="Password"
android:inputType="textPassword"
android:textSize="20sp"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Email"
app:libIZO_clearIconTint="#8f1f15"
app:libIZO_setBorderColor="#8f1f15"
app:libIZO_setBorderView="true"
app:libIZO_setClearIconVisible="true"
app:libIZO_setCornerRadius="4dp"
app:libIZO_setStrokeWidth="2dp" />
<mehdi.sakout.fancybuttons.FancyButton
android:id="#+id/Login"
android:layout_width="204dp"
android:layout_height="75dp"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Password"
fancy:fb_borderColor="#FFFFFF"
fancy:fb_borderWidth="1dp"
fancy:fb_defaultColor="#7ab800"
fancy:fb_focusColor="#9bd823"
fancy:fb_iconPosition="left"
fancy:fb_radius="30dp"
fancy:fb_text="Login / Register"
fancy:fb_textColor="#FFFFFF"
fancy:fb_textSize="25dp" />
<TextView
android:id="#+id/Forgot_Password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot Password ?"
android:textSize="30dp"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Login" />
<ProgressBar
android:id="#+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:visibility="gone"/>
<Button
android:id="#+id/Google"
android:layout_width="168dp"
android:layout_height="145dp"
android:layout_marginTop="20dp"
android:background="#drawable/ic_google"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Forgot_Password" />
<Button
android:id="#+id/Phone"
android:layout_width="168dp"
android:layout_height="145dp"
android:background="#drawable/ic_phone"
android:layout_marginTop="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Forgot_Password" />
<Button
android:id="#+id/Facebook"
android:layout_width="208dp"
android:layout_height="156dp"
android:background="#drawable/ic_facebook"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/Google"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
<android.support.constraint.ConstraintLayout 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"
tools:context="com.code.zero.drivermechanicsapp.AccidentAlertFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:text="Report Road Incident"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView2"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
tools:text="Report Road Incident"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:textSize="18sp"
android:textStyle="bold"/>
<TextView
android:text="Concern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
tools:text="Concern"
app:layout_constraintTop_toTopOf="#+id/editText" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/editText"
android:layout_marginStart="120dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="120dp"
android:layout_marginTop="64dp"
app:layout_constraintTop_toBottomOf="#+id/textView2" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/editText"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText" />
<TextView
android:text="Where"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView5"
tools:text="Where"
app:layout_constraintTop_toTopOf="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/textView3" />
<TextView
android:text="Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView6"
tools:text="Description"
app:layout_constraintLeft_toLeftOf="#+id/textView5"
app:layout_constraintTop_toTopOf="#+id/editText4"
android:minLines="3"
android:maxLines="5"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:ems="10"
android:id="#+id/editText4"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/editText2"
android:maxLines="5"
android:minLines="3" />
<Button
android:text="Send S.O.S."
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="#+id/button"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:text="Phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView21"
app:layout_constraintLeft_toLeftOf="#+id/textView6"
app:layout_constraintTop_toTopOf="#+id/editText3" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="#+id/editText3"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText4"
app:layout_constraintLeft_toLeftOf="#+id/editText4" />
because as i type it will block the screen. i cant even see what im typing.
and i'm really new in this android development. i don't know what to do.
can you please help me with this>?
because as i type it will block the screen. i cant even see what im typing.
and i'm really new in this android development. i don't know what to do.
can you please help me with this>?
put your views in scrollView like below:
<FrameLayout 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"
>
<ScrollView
android:id="#+id/scrollView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:text="Report Road Incident"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView2"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
tools:text="Report Road Incident"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:textSize="18sp"
android:textStyle="bold"/>
<TextView
android:text="Concern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
tools:text="Concern"
app:layout_constraintTop_toTopOf="#+id/editText" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/editText"
android:layout_marginStart="120dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="120dp"
android:layout_marginTop="64dp"
app:layout_constraintTop_toBottomOf="#+id/textView2" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/editText"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText" />
<TextView
android:text="Where"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView5"
tools:text="Where"
app:layout_constraintTop_toTopOf="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/textView3" />
<TextView
android:text="Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView6"
tools:text="Description"
app:layout_constraintLeft_toLeftOf="#+id/textView5"
app:layout_constraintTop_toTopOf="#+id/editText4"
android:minLines="3"
android:maxLines="5"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:ems="10"
android:id="#+id/editText4"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/editText2"
android:maxLines="5"
android:minLines="3" />
<Button
android:text="Send S.O.S."
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="#+id/button"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:text="Phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView21"
app:layout_constraintLeft_toLeftOf="#+id/textView6"
app:layout_constraintTop_toTopOf="#+id/editText3" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="#+id/editText3"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText4"
app:layout_constraintLeft_toLeftOf="#+id/editText4" />
</LinearLayout>
</ScrollView>
</FrameLayout>
To scroll your screen you simply need to do put a ScrollView inside your layout, like that:
<android.support.constraint.ConstraintLayout 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"
tools:context="com.code.zero.drivermechanicsapp.AccidentAlertFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:text="Report Road Incident"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView2"
android:layout_marginTop="16dp"
app:layout_constraintTop_toTopOf="parent"
tools:text="Report Road Incident"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginRight="16dp"
android:textSize="18sp"
android:textStyle="bold"/>
<TextView
android:text="Concern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="16dp"
tools:text="Concern"
app:layout_constraintTop_toTopOf="#+id/editText" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/editText"
android:layout_marginStart="120dp"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginLeft="120dp"
android:layout_marginTop="64dp"
app:layout_constraintTop_toBottomOf="#+id/textView2" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/editText"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText" />
<TextView
android:text="Where"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView5"
tools:text="Where"
app:layout_constraintTop_toTopOf="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/textView3" />
<TextView
android:text="Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView6"
tools:text="Description"
app:layout_constraintLeft_toLeftOf="#+id/textView5"
app:layout_constraintTop_toTopOf="#+id/editText4"
android:minLines="3"
android:maxLines="5"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:ems="10"
android:id="#+id/editText4"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText2"
app:layout_constraintLeft_toLeftOf="#+id/editText2"
android:maxLines="5"
android:minLines="3" />
<Button
android:text="Send S.O.S."
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="#+id/button"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:text="Phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView21"
app:layout_constraintLeft_toLeftOf="#+id/textView6"
app:layout_constraintTop_toTopOf="#+id/editText3" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="phone"
android:ems="10"
android:id="#+id/editText3"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="#+id/editText4"
app:layout_constraintLeft_toLeftOf="#+id/editText4" />
</ScrollView>
If it says ScrollView can only have one child. Put the children in a single Layout like LinearLayout.