how to setup full scroll of all Edit textview in android

113 views Asked by At

enter image description here

enter image description here

this is my screen coming after entering data scrollview is not full up till Pin Code edit text below is xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/splash_screen_bg"
    android:orientation="vertical"
    android:weightSum="5.0">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_marginLeft="21dp"
        android:layout_marginRight="21dp"
        android:gravity="center_vertical"
        android:orientation="vertical"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="15.0dip">

        <TextView
            android:id="@+id/adresstextview"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:imeOptions="actionNext"
            android:lines="3"
            android:text="klsdjashd"
            android:textColor="#ffffff"
            android:textColorHint="#FFFFFF"
            android:textSize="16dp" />
    </LinearLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"

        android:layout_weight="1"
        android:gravity="center_vertical">

        <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_weight="1"
            android:orientation="vertical"
            android:isScrollContainer="true"
            android:gravity="center_vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">


                <LinearLayout
                    android:id="@+id/linarlayout2"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="4.16"
                    android:gravity="center_vertical"
                    android:orientation="vertical">


                    <EditText
                        android:id="@+id/nameeditetext"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_marginLeft="21dp"
                        android:layout_marginRight="21dp"
                        android:background="@drawable/baorder1"
                        android:hint="Name"
                        android:imeOptions="actionNext"
                        android:paddingLeft="20dip"
                        android:paddingRight="10dip"
                        android:singleLine="true"
                        android:textColor="#ffffff"
                        android:textColorHint="#FFFFFF"
                        android:textSize="20dp" />

                    <EditText
                        android:id="@+id/edittextemailaddrress"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_gravity="center"
                        android:layout_marginLeft="21dp"
                        android:layout_marginRight="21dp"
                        android:layout_marginTop="15dp"
                        android:background="@drawable/baorder1"
                        android:hint="Email Adress"
                        android:imeOptions="actionNext"
                        android:paddingLeft="20dip"
                        android:paddingRight="10dip"
                        android:singleLine="true"
                        android:textColor="#ffffff"
                        android:textColorHint="#FFFFFF"
                        android:textSize="20dp" />

                    <EditText
                        android:id="@+id/edittextadress"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_marginLeft="21dp"
                        android:layout_marginRight="21dp"
                        android:layout_marginTop="15dp"
                        android:background="@drawable/baorder1"
                        android:ems="10"
                        android:fontFamily="calibri"
                        android:gravity="center_vertical|left"
                        android:hint="Address"
                        android:imeOptions="actionNext"
                        android:paddingLeft="20dip"
                        android:paddingRight="10dip"
                        android:singleLine="true"
                        android:textColor="#ffffff"
                        android:textColorHint="#FFFFFF"
                        android:textSize="20dp">

                        <requestFocus />
                    </EditText>


                    <EditText
                        android:id="@+id/spinner2"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginLeft="21dp"
                        android:layout_marginRight="21dp"
                        android:layout_marginTop="15dp"
                        android:background="@drawable/baorder1"
                        android:ems="10"


                        android:fontFamily="calibri"
                        android:gravity="center_vertical|left"
                        android:hint="Enter Location"

                        android:imeOptions="actionNext"
                        android:paddingLeft="20dip"
                        android:paddingRight="10dip"
                        android:singleLine="true"
                        android:textColor="#ffffff"
                        android:textColorHint="#FFFFFF"
                        android:textSize="20dp"


                        />


                    <EditText

                        android:id="@+id/edittextcity"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_marginLeft="21dp"
                        android:layout_marginRight="21dp"
                        android:layout_marginTop="15dp"
                        android:background="@drawable/baorder1"
                        android:ems="10"
                        android:fontFamily="calibri"
                        android:gravity="center_vertical|left"
                        android:hint="Enter City"
                        android:imeOptions="actionNext"
                        android:paddingLeft="20dip"
                        android:paddingRight="10dip"
                        android:singleLine="true"
                        android:textColor="#ffffff"
                        android:textColorHint="#FFFFFF"
                        android:textSize="20dp" />

                    <EditText

                        android:id="@+id/editextpincode"
                        android:layout_width="match_parent"
                        android:layout_height="48dp"
                        android:layout_marginLeft="21dp"
                        android:layout_marginRight="21dp"
                        android:layout_marginTop="15dp"
                        android:background="@drawable/baorder1"
                        android:ems="10"
                        android:fontFamily="calibri"
                        android:gravity="center_vertical|left"
                        android:hint="Enter Pin Code"
                        android:imeOptions="actionDone"
                        android:inputType="phone"
                        android:paddingLeft="20dip"
                        android:paddingRight="10dip"
                        android:singleLine="true"
                        android:textColor="#ffffff"
                        android:textColorHint="#FFFFFF"


                        android:textSize="20dp"


                        />

                </LinearLayout>
            </RelativeLayout>
        </ScrollView>
    </RelativeLayout>

    <LinearLayout
        android:id="@+id/linarlayout3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:id="@+id/uploadButton"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="21dp"
            android:layout_marginRight="21dp"
            android:layout_marginTop="15dp"
            android:background="@drawable/brand_green_btn"

            android:fontFamily="calibri"
            android:gravity="center_horizontal"
            android:paddingBottom="10dp"
            android:paddingLeft="20dip"
            android:paddingRight="20dip"
            android:paddingTop="10dp"
            android:text="SAVE"
            android:textColor="#ffffff"
            android:textSize="20dp" />
    </LinearLayout>


</LinearLayout>

please suggest me where am doing wrong i have given scroll view but its not full scroll.

2

There are 2 answers

0
bharat7777 On BEST ANSWER

you can set adjustPan at activity in your manifest.

<activity
        android:name="com.example.adjustscroll.MainActivity"
        android:label="@string/app_name"
        android:windowSoftInputMode="adjustPan|stateAlwaysHidden" >

    </activity>
4
Sunny On

ScrollView can have only one child.

So you need to wrap your layout in one Relative/Linear Layout and put that Layout under ScrollView. for eg:

<ScrollView
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/bottom_layout">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/gray">

        <RelativeLayout
            android:id="@+id/layout_driver"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white"
            android:padding="6dp"
           android:visibility="gone">

            <de.hdodenhof.circleimageview.CircleImageView
                android:id="@+id/driver_image"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_alignParentTop="true"
                android:src="@drawable/profile" />

            <TextView
                android:id="@+id/tv_driver_name"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:layout_toEndOf="@+id/driver_image"
                android:layout_toRightOf="@+id/driver_image"
                android:textColor="@android:color/black"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/tv_youRated"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/tv_driver_name"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:layout_marginTop="10dp"
                android:layout_toEndOf="@+id/driver_image"
                android:layout_toRightOf="@+id/driver_image"
                android:text="@string/rate" />

            <RatingBar
                android:id="@+id/driver_rating"
                style="?android:attr/ratingBarStyleSmall"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/tv_driver_name"
                android:layout_marginLeft="10dp"
                android:layout_marginStart="10dp"
                android:layout_marginTop="11dp"
                android:layout_toEndOf="@+id/tv_youRated"
                android:layout_toRightOf="@+id/tv_youRated"
                android:isIndicator="true"
                android:theme="@style/RatingBar" />
        </RelativeLayout>

        <LinearLayout
            android:id="@+id/car_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/layout_driver"
            android:layout_marginTop="1dp"
            android:background="@android:color/white"
            android:padding="10dp">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                app:srcCompat="@drawable/sedan_car1"
                android:contentDescription="@string/none" />

            <TextView
                android:id="@+id/carType"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"

                android:textAllCaps="true"
                android:textColor="@android:color/black"
                android:textStyle="bold" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="5dp"
                android:layout_marginStart="5dp"
                android:text="\u25CF"
                android:textAllCaps="true"
                android:textSize="4sp"
                android:textStyle="bold"
                tools:ignore="SmallSp" />

            <TextView
                android:id="@+id/carDetail"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:layout_marginLeft="5dp"
                android:layout_marginStart="5dp"
                android:textAllCaps="true"
                android:textColor="@android:color/black"
                android:textStyle="bold"
                android:visibility="gone"/>
        </LinearLayout>

        <LinearLayout
            android:id="@+id/distance_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/car_layout"
            android:layout_marginTop="1dp"
            android:background="@android:color/white"
            android:gravity="center"
            android:orientation="horizontal"
            android:padding="5dp"
            android:visibility="gone">

            <TextView
                android:id="@+id/totalDistance"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                android:padding="10dp"
                android:textAllCaps="true"
                android:textSize="18sp"
                android:textStyle="bold" />

            <View
                android:layout_width="2dp"
                android:layout_height="match_parent"
                android:background="@android:color/darker_gray" />

            <TextView
                android:id="@+id/totalTime"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                android:padding="10dp"
                android:textAllCaps="true"
                android:textSize="18sp"
                android:textStyle="bold" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/rider_detail"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/distance_layout"
            android:layout_marginTop="1dp"
            android:background="@android:color/white"
            android:orientation="horizontal"
            android:padding="3dp">

            <TextView
                android:id="@+id/tv_riderName"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:hint="@string/rider_name"
                android:padding="10dp"
                android:textAllCaps="true" />

            <TextView
                android:id="@+id/tv_passengerCount"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight=".5"
                android:singleLine="true"
                android:padding="10dp"
                android:text="@string/plusOne" />

            <TextView
                android:id="@+id/tv_maleGender"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight=".5"
                android:padding="10dp"
                android:singleLine="true"
                android:text="@string/oneMale"
                android:textAllCaps="true" />

            <TextView
                android:id="@+id/tv_femaleGender"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight=".5"
                android:padding="10dp"
                android:singleLine="true"
                android:text="@string/oneFemale"
                android:textAllCaps="true" />


        </LinearLayout>

        <RelativeLayout
            android:id="@+id/address_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/rider_detail"
            android:layout_marginTop="1dp"
            android:background="@android:color/white"
            android:padding="6dp">

            <TextView
                android:id="@+id/time1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="5dp"
                android:visibility="gone"/>

            <TextView
                android:id="@+id/time2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/time1"
                android:layout_marginTop="15dp"
                android:padding="5dp"
                android:visibility="gone"/>

            <View
                android:id="@+id/green_dot"
                android:layout_width="8dp"
                android:layout_height="8dp"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:layout_marginTop="12dp"
                android:layout_toEndOf="@+id/time1"
                android:layout_toRightOf="@+id/time1"
                android:background="@drawable/green_circle"
                android:textColor="@android:color/holo_green_light"
                android:textSize="8sp"
                tools:ignore="SmallSp" />

            <TextView
                android:id="@+id/dotted_line"
                android:layout_width="2dp"
                android:layout_height="wrap_content"
                android:layout_below="@id/green_dot"
                android:layout_marginLeft="23dp"
                android:layout_marginStart="23dp"
                android:layout_marginTop="3dp"
                android:layout_toEndOf="@+id/time1"
                android:layout_toRightOf="@+id/time1"
                android:background="@drawable/dotted_vertical_line"
                android:gravity="top"
                android:padding="5dp" />

            <View
                android:id="@+id/red_dot"
                android:layout_width="8dp"
                android:layout_height="8dp"
                android:layout_below="@+id/dotted_line"
                android:layout_marginLeft="20dp"
                android:layout_marginStart="20dp"
                android:layout_marginTop="3dp"
                android:layout_toEndOf="@+id/time2"
                android:layout_toRightOf="@+id/time2"
                android:background="@drawable/red_circle"
                android:gravity="top"
                android:textColor="@android:color/holo_red_light"
                android:textSize="8sp"
                tools:ignore="SmallSp" />

            <TextView
                android:id="@+id/source_address"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:layout_marginStart="5dp"
                android:layout_toEndOf="@+id/red_dot"
                android:layout_toRightOf="@+id/red_dot"
                android:padding="5dp"
                android:singleLine="true"
                />

            <TextView
                android:id="@+id/destination_address"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/source_address"
                android:layout_marginLeft="5dp"
                android:layout_marginStart="5dp"
                android:layout_marginTop="15dp"
                android:layout_toEndOf="@+id/green_dot"
                android:layout_toRightOf="@+id/green_dot"
                android:padding="5dp"
                android:singleLine="true" />
        </RelativeLayout>

        <RelativeLayout
            android:id="@+id/bill_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/address_layout"
            android:layout_marginTop="1dp"
            android:background="@android:color/white"
            android:padding="10dp">

            <TextView
                android:id="@+id/tv_billDetail"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/billDetail"
                android:textAllCaps="true"
                android:textColor="@android:color/black"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/tv_totalFare"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/tv_billDetail"
                android:layout_marginTop="5dp"
                android:padding="5dp"
                android:text="@string/totalFare"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/tv_taxes"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/tv_totalFare"
                android:layout_marginTop="5dp"
                android:padding="5dp"
                android:text="@string/tax"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/totalFare"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/tv_billDetail"
                android:layout_marginTop="5dp"
                android:padding="5dp"
                 />

            <TextView
                android:id="@+id/taxes"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/totalFare"
                android:layout_marginTop="5dp"
                android:padding="5dp"
                 />

            <View
                android:id="@+id/view1"
                android:layout_width="match_parent"
                android:layout_height="2dp"
                android:layout_below="@id/taxes"
                android:background="@drawable/dotted_vertical_line" />

            <TextView
                android:id="@+id/tv_payment_charge"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/view1"
                android:layout_marginTop="5dp"
                android:padding="5dp"
                android:text="@string/handling"
                android:textAllCaps="true" />

            <TextView
                android:id="@+id/payment_handling_charge"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/taxes"
                android:layout_marginTop="5dp"
                android:padding="5dp"
                />

            <View
                android:id="@+id/view2"
                android:layout_width="match_parent"
                android:layout_height="2dp"
                android:layout_below="@id/tv_payment_charge"
                android:background="@drawable/dotted_vertical_line" />

            <TextView
                android:id="@+id/tv_totalBill"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true"
                android:layout_below="@+id/view2"
                android:layout_marginTop="5dp"
                android:padding="5dp"
                android:text="@string/bill"
                android:textColor="@android:color/black"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/total_bill"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentEnd="true"
                android:layout_alignParentRight="true"
                android:layout_below="@+id/view2"
                android:layout_marginTop="5dp"
                android:drawableLeft="@drawable/rupee_selector"
                android:drawableStart="@drawable/rupee_selector"
                android:padding="5dp"
                android:textColor="@android:color/black"
                android:textStyle="bold" />

            <View
                android:id="@+id/view4"
                android:layout_width="match_parent"
                android:layout_height="2dp"
                android:layout_below="@id/total_bill"
                android:background="@drawable/background" />
        </RelativeLayout>
    </RelativeLayout>
</ScrollView> 

Hope that helps.?