ScrollView is failing to scroll its child layout - android

This is my coding I have added a Scrollview and I have dynamic data that I want to scroll but it's not scrolling entirely. I Tried many solution but still its of No use. Please check and if found any error help me. This scrollview has a child relative layout. I did the same code before in another activity and that is working fine but here it is not working fine.
Thanks in Advance
<ScrollView
android:id="#+id/scrolllayouts"
android:layout_above="#+id/linear_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:layout_below="#+id/relative">
<RelativeLayout
android:id="#+id/customerdetails"
android:background="#color/backgrey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:layout_alignParentTop="true"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:id="#+id/orderlayout"
android:background="#drawable/bottomline"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:fontFamily="sans-serif"
android:textSize="20dp"
android:layout_centerInParent="true"
android:id="#+id/TVOrderIDs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="zzzzzzzzzzz"
android:textColor="#3c3c3c"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/namediv"
android:layout_below="#+id/orderlayout"
android:paddingTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:textSize="15sp"
android:layout_alignParentStart="true"
android:id="#+id/TVCustomerNamelbls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:layout_marginStart="20dp"
android:text="Customer Name"
android:textColor="#faba62"/>
<TextView
android:fontFamily="sans-serif"
android:layout_marginStart="20dp"
android:layout_below="#+id/TVCustomerNamelbls"
android:textSize="16sp"
android:layout_alignParentStart="true"
android:id="#+id/TVCustomerNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#3c3c3c"/>
<TextView
android:fontFamily="sans-serif"
android:layout_marginStart="20dp"
android:layout_below="#+id/TVCustomerNames"
android:textSize="16sp"
android:layout_alignParentStart="true"
android:id="#+id/TVMobilenumbers"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#3c3c3c"/>
<TextView
android:textSize="15sp"
android:id="#+id/TVAddTimelbls"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:layout_marginEnd="20dp"
android:text="Delivery Time"
android:textColor="#faba62"/>
<TextView
android:fontFamily="sans-serif"
android:layout_marginEnd="20dp"
android:layout_below="#+id/TVAddTimelbls"
android:textSize="16sp"
android:layout_alignParentEnd="true"
android:id="#+id/TVAddTimes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#3c3c3c"/>
<TextView
android:fontFamily="sans-serif"
android:layout_marginEnd="20dp"
android:layout_below="#+id/TVAddTimes"
android:textSize="16sp"
android:layout_alignParentEnd="true"
android:id="#+id/TVtimes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#3c3c3c"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/amountdivs"
android:layout_below="#+id/namediv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/TVTotAmtlbls"
android:textSize="15sp"
android:layout_alignParentStart="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:layout_marginStart="20dp"
android:text="Total Amount"
android:textColor="#faba62"/>
<TextView
android:id="#+id/TVTotAmtss"
android:fontFamily="sans-serif"
android:layout_marginLeft="20dp"
android:layout_below="#+id/TVTotAmtlbls"
android:textSize="16sp"
android:layout_alignParentStart="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_marginTop="1dp"
android:textColor="#3c3c3c"
/>
<TextView
android:layout_marginTop="10dp"
android:layout_below="#+id/TVTotAmtss"
android:id="#+id/TVStatuslbls"
android:textSize="15sp"
android:layout_alignParentStart="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:layout_marginStart="20dp"
android:text="Order Status"
android:textColor="#faba62"/>
<TextView
android:id="#+id/TVStatuss"
android:fontFamily="sans-serif"
android:layout_marginLeft="20dp"
android:layout_below="#+id/TVStatuslbls"
android:textSize="16sp"
android:layout_alignParentStart="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delivered"
android:layout_marginTop="1dp"
android:textColor="#3c3c3c"
/>
<TextView
android:textSize="15sp"
android:id="#+id/EDReceivedAmtlbls"
android:fontFamily="sans-serif"
android:layout_marginRight="20dp"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Recieved Amount"
android:textColor="#faba62"
/>
<TextView
android:layout_marginTop="1dp"
android:fontFamily="sans-serif"
android:text=""
android:layout_alignParentEnd="true"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#3c3c3c"
android:id="#+id/EDReceivedAmts"
android:layout_below="#+id/EDReceivedAmtlbls"
android:layout_alignEnd="#+id/TVTotAmtss"
android:layout_marginEnd="20dp"
/>
<TextView
android:textSize="15sp"
android:layout_marginTop="10dp"
android:layout_alignEnd="#+id/TVStatuslbls"
android:layout_below="#+id/EDReceivedAmts"
android:id="#+id/EDDeliveredTimelbls"
android:fontFamily="sans-serif"
android:layout_marginRight="20dp"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Delivered Time"
android:textColor="#faba62"
/>
<TextView
android:fontFamily="sans-serif"
android:layout_alignParentEnd="true"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:textColor="#3c3c3c"
android:id="#+id/DeliveredTimes"
android:layout_below="#+id/EDDeliveredTimelbls"
android:layout_marginEnd="20dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_below="#+id/amountdivs"
android:id="#+id/titledivs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp">
<TextView
android:textSize="15sp"
android:layout_centerHorizontal="true"
android:id="#+id/TVAddressNamelbls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:text="Address"
android:textColor="#faba62"/>
<TextView
android:fontFamily="sans-serif"
android:layout_centerHorizontal="true"
android:layout_below="#+id/TVAddressNamelbls"
android:textSize="16sp"
android:id="#+id/TVAddressNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#3c3c3c"/>
</RelativeLayout>
<RelativeLayout
android:id="#+id/adresdivs"
android:layout_below="#+id/titledivs"
android:layout_marginTop="5dp"
android:background="#drawable/allline"
android:layout_marginRight="30dp"
android:layout_marginLeft="30dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:layout_width="match_parent"
android:layout_height="60dp"
android:paddingTop="5dp">
<TextView
android:id="#+id/TVAddresss"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:fontFamily="sans-serif"
android:text=""
android:textColor="#3c3c3c" />
</RelativeLayout>
<RelativeLayout
android:layout_below="#+id/adresdivs"
android:id="#+id/remarksdivs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp">
<TextView
android:textSize="15sp"
android:layout_centerHorizontal="true"
android:id="#+id/EDRemarkslbls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:text="My Remarks"
android:textColor="#faba62"/>
<TextView
android:padding="10dp"
android:lines="4"
android:minLines="1"
android:gravity="top|left"
android:maxLines="6"
android:id="#+id/EDRemarkss"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="#+id/EDRemarkslbls"
android:layout_marginLeft="30dp"
android:layout_marginTop="5dp"
android:layout_marginRight="30dp"
android:textSize="13dp"
android:textCursorDrawable="#drawable/cursor_color"
android:background="#drawable/allline"
android:textColor="#3c3c3c" />
</RelativeLayout>
<LinearLayout
android:id="#+id/table"
android:layout_alignParentBottom="true"
android:layout_below="#+id/remarksdivs"
android:background="#color/backgrey"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical">
<HorizontalScrollView
android:background="#color/colorWhite"
android:id="#+id/horizontalViewss"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
android:scrollbars="horizontal">
<TableLayout
android:id="#+id/TBMainss"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow android:id="#+id/TRMainss">
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:gravity="center"
android:fontFamily="sans-serif"
android:textAlignment="center"
android:id="#+id/TVDPrImgs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fce1ac"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="Image"
android:textColor="#color/colorBlack" />
<TextView
android:id="#+id/TVDPrNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fce1ac"
android:fontFamily="sans-serif"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingTop="5dp"
android:paddingRight="20dp"
android:paddingBottom="5dp"
android:text="Product"
android:textColor="#color/colorBlack" />
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:fontFamily="sans-serif"
android:id="#+id/TVDCatNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fce1ac"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="Category"
android:textColor="#color/colorBlack"
/>
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:fontFamily="sans-serif"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fce1ac"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:textColor="#color/colorBlack"
android:id="#+id/DTVQtys"
android:text="Quantity"
/>
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:fontFamily="sans-serif"
android:id="#+id/TVDUOMs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fce1ac"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="Unit"
android:textColor="#color/colorBlack"
/>
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:fontFamily="sans-serif"
android:id="#+id/TVDTotAmts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fce1ac"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="Amount"
android:textColor="#color/colorBlack"
/>
<TextView
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:fontFamily="sans-serif"
android:id="#+id/TVDBranchNames"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#fce1ac"
android:gravity="center"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="Branch"
android:textColor="#color/colorBlack"
/>
</TableRow>
</TableLayout>
</HorizontalScrollView>
</ScrollView>
</LinearLayout>
</RelativeLayout>
</ScrollView>

**Try to use NestedScrollView**
<android.support.v4.widget.NestedScrollView
android:id="#+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
</android.support.v4.widget.NestedScrollView>
For androidx supported use below code
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:fillViewport="true">
</androidx.core.widget.NestedScrollView>

Related

Relative Layout - android - Make a Relative Layout Scrollable

I am making a Speed Dial App, which has Emergency Numbers hard-coded in it. Using nested Relative Layout and made a list of numbers.
Below is the Emergency Numbers Page.
This is a Page of Dialer App, where it has a dialer and this is the Speed Dial Section Fragment which is not scrollable.
Below is my XML fragment for the above image.
<LinearLayout 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"
android:padding="10dp"
android:orientation="vertical">
<!-- Relative Layouts Emergency Numbers Here - Logic - Increment Nums by 1-->
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout2">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView1"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 1"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnPolisi"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout3"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout4"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView2"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 2"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnRS"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout5"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout6"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView3"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 3"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnFire"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout7"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout8"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView4"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 4"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnEmg4"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout9"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout10"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView5"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 5"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnEmg5"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout11"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout9"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout12"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView6"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 6"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnEmg6"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout13"
android:layout_marginTop="8dp"
android:layout_below="#+id/relativeLayout11"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<RelativeLayout
android:id="#+id/relativeLayout14"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/imageView7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView7"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 7"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnEmg7"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
I have tried with the ListView inside the nested relative layout. And even the scrollview for the same, some were fatal when used. I may be using some absurd logic in this code, but the view is great for me, I just need this code to make the layout scrollable. Kindly let me know where I need to change in my code to make the page scrollable.//
When I posted this question few logical issues were there in my layouts, now I have framed it logically and it;s inside a Linear Layout.
It isnt working anyway.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
// Write here your whole code without writing first Relative Layout....
</RelativeLayout>
</ScrollView>
<RelativeLayout>
You need to put your layout inside a Scroll View. But a scroll view can have only ONE direct child. So what you need to do is take you top most relative layout and put that inside a scroll view. Something like this:
<ScrollView
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">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:orientation="vertical">
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:layout_marginTop="10dp"
android:layout_below="#+id/relativeLayout4"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout7">
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_below="#+id/textView5" >
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<ImageView
android:id="#+id/imageView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView3"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 3"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnFire"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout2">
<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_below="#+id/textView" >
<ImageView
android:id="#+id/imageView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/txtNama"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView2"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 1"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:id="#+id/btnPolisi"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:layout_marginTop="10dp"
android:layout_below="#+id/relativeLayout2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/relativeLayout4">
<TextView
android:id="#+id/tvnew"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_below="#+id/tvnew" >
<ImageView
android:id="#+id/ivscreenshot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 2"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnRS"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout5"
android:layout_marginTop="12dp"
android:layout_below="#+id/relativeLayout7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/tvnew1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout6"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/tvnew1"
android:layout_alignStart="#+id/tvnew1">
<ImageView
android:id="#+id/ivscreenshot1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot1"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 4"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnEmg4"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout8"
android:layout_marginTop="16dp"
android:layout_below="#+id/relativeLayout5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/tvnew2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout10"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/tvnew2"
android:layout_alignStart="#+id/tvnew2">
<ImageView
android:id="#+id/ivscreenshot2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot1"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 5"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnEmg5"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout11"
android:layout_marginTop="14dp"
android:layout_below="#+id/relativeLayout8"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/tvnew3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout12"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/tvnew3"
android:layout_alignStart="#+id/tvnew3">
<ImageView
android:id="#+id/ivscreenshot3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot3"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 6"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnEmg6"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:background="#drawable/border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="0dp"
android:id="#+id/relativeLayout13"
android:layout_marginTop="7dp"
android:layout_below="#+id/relativeLayout11"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="#+id/tvnew4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#drawable/btn_flat_white"
android:gravity="center"
android:padding="5dp"
android:text="NEW"
android:textColor="#fff"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/relativeLayout14"
android:layout_width="match_parent"
android:paddingBottom="10dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignLeft="#+id/tvnew4"
android:layout_alignStart="#+id/tvnew4">
<ImageView
android:id="#+id/ivscreenshot4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true" />
<TextView
android:id="#+id/tvwords4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ivscreenshot4"
android:layout_marginTop="12px"
android:gravity="left"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingTop="5dp"
android:text="Emergency Number 7"
android:textAllCaps="true"
android:textSize="16sp"
android:textStyle="bold" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Call"
android:id="#+id/btnEmg7"
android:background="#drawable/btn_flat_blue_rounded_shadow"
android:textColor="#fff"
android:padding="10dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
If you want to do with code:
ScrollView scrollview = new ScrollView(this);
scrollview.addView(wView);

How to fix background image with scrollView and textviews with edittext

How to fix background image with scrollview when windowSoftInputMode appears.
I used windowSoftInputMode="adjustPan",but scrollview doesn't work
completely, please help me. Last fields do not appear when virtual keyboard
appears.
I want that background image should not scroll up with virtual keyboard
and scrollview should show all the fields inside it while scrolling.
Here is my code
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#drawable/back">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cancel_done_btn"
android:layout_marginLeft="30dp"
android:layout_marginTop="40dp"
android:textSize="17dp"
android:paddingTop="10dp"
android:textStyle="bold"
android:paddingBottom="10dp"
android:paddingLeft="28dp"
android:paddingRight="28dp"
android:text="#string/cancel"
android:id="#+id/btn_cancel_signin"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/cancel_done_btn"
android:layout_marginRight="30dp"
android:layout_marginTop="40dp"
android:textSize="17dp"
android:text="#string/done"
android:paddingTop="10dp"
android:textStyle="bold"
android:paddingBottom="10dp"
android:paddingLeft="35dp"
android:paddingRight="35dp"
android:layout_alignParentRight="true"
android:id="#+id/btn_done_signin"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:layout_marginLeft="40dp"
android:orientation="vertical"
android:layout_below="#+id/btn_cancel_signin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="times new roman"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Tuesday,May"
android:textSize="25dp"
android:textStyle="bold"
android:id="#+id/tv_day_month" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="times new roman"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text=" 7,2016"
android:textSize="25dp"
android:textStyle="bold"
android:id="#+id/tv_date" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="200dp"
android:layout_marginLeft="130dp"
android:layout_below="#+id/btn_cancel_signin">
<ImageView
android:id="#+id/iv_signin_logo"
android:layout_width="200dp"
android:layout_height="180dp"
android:src="#drawable/sign_in_logo"
android:layout_marginTop="10dp" />
</LinearLayout>
<ScrollView
android:layout_width="350dp"
android:layout_height="wrap_content"
android:id="#+id/scroller_sign_in"
android:layout_below="#+id/btn_done_signin"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<LinearLayout
android:orientation="vertical"
android:paddingLeft="10dp"
android:layout_marginRight="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="30dp">
<TextView
android:layout_height="wrap_content"
android:text="First Name"
style="#style/sign_in_text"
android:id="#+id/label_firstname"
android:layout_alignParentLeft="true"
android:paddingTop="10dp"
android:inputType="textCapWords"
/>
<AutoCompleteTextView
android:id="#+id/et_firstname"
android:hint="Required"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
>
<TextView
android:layout_height="wrap_content"
android:text="Last Name"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_lastname"
android:paddingTop="10dp"
android:layout_alignParentLeft="true"
android:inputType="textCapWords"
/>
<AutoCompleteTextView
android:id="#+id/et_lastname"
android:hint="Required"
android:ems="10"
android:textSize="20dp"
android:textAllCaps="true"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_company"
>
<TextView
android:layout_height="wrap_content"
android:text="Company"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:layout_marginTop="10dp"
android:id="#+id/label_company"
android:layout_alignParentLeft="true"
/>
<AutoCompleteTextView
android:id="#+id/et_company"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:textAllCaps="true"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<!--android:background="#drawable/contact_edittext_bg"-->
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_address"
>
<TextView
android:layout_height="wrap_content"
android:text="Address"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_address"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_address"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_city"
>
<TextView
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:layout_height="wrap_content"
android:text="City"
android:id="#+id/label_city"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_city"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_state"
>
<AutoCompleteTextView
android:id="#+id/et_state"
android:ems="10"
android:textSize="20dp"
android:padding="10dp"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:inputType="textCapWords"/>
<TextView
android:layout_height="wrap_content"
android:text="State"
style="#style/sign_in_text"
android:id="#+id/label_state"
android:paddingTop="15dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="20dp"
android:id="#+id/ll_zip_code"
>
<TextView
android:layout_height="wrap_content"
android:text="Zip Code"
android:layout_width="wrap_content"
android:paddingRight="10dp"
android:gravity="left"
android:id="#+id/label_zip_code"
android:paddingTop="15dp"
/>
<AutoCompleteTextView
android:id="#+id/et_zipcode"
android:ems="10"
android:layout_width="160dp"
android:background="#drawable/et_border"
android:textSize="20dp"
android:padding="10dp"
android:layout_height="wrap_content"
android:inputType="number"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
remove this from xml.
android:background="#drawable/back"
Write in your java file.
getWindow().setBackgroundDrawableResource(R.drawable.back);

Android Java How to make half screen keyboard and done in the edit text at the same time?

I want to make an EditText that its keyboard fills half screen in Landscape mode but also to have the done available at the same time since I have more than one EditText in my layout.
How can I use
android:imeOptions="flagNoExtractUi"
and
android:imeOptions="actionDone"
at the same time!!!
Here is the code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.ommabdelhafiz.amathmess.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="7"
android:textSize="16sp"
android:id="#+id/first_1st"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="×"
android:textSize="16sp"
/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="7"
android:textSize="16sp"
android:id="#+id/first_2nd"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="="
android:textSize="16sp"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:inputType="number"
android:maxLength="3"
android:hint=" "
android:id="#+id/first_ans"
android:imeOptions="flagNoExtractUi"
android:layout_marginRight="20dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:layout_gravity="center_horizontal"
android:id="#+id/first_true_ans"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:gravity="bottom"
android:layout_gravity="center_horizontal"
android:id="#+id/first_false_ans"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check"
android:layout_marginLeft="20dp"
android:onClick="check1st"
android:id="#+id/first_btn"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="49"
android:textSize="16sp"
android:id="#+id/second_1st"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="÷"
android:textSize="16sp"
/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="7"
android:textSize="16sp"
android:id="#+id/second_2nd"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="="
android:textSize="16sp"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:inputType="number"
android:maxLength="2"
android:hint=" "
android:id="#+id/second_ans"
android:imeOptions="flagNoExtractUi"
android:layout_marginRight="20dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:layout_gravity="center_horizontal"
android:id="#+id/second_true_ans"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:gravity="bottom"
android:layout_gravity="center_horizontal"
android:id="#+id/second_false_ans"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check"
android:layout_marginLeft="20dp"
android:onClick="check2nd"
android:id="#+id/second_btn"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="711"
android:textSize="16sp"
android:id="#+id/third_1st"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="×"
android:textSize="16sp"
/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="7"
android:textSize="16sp"
android:id="#+id/third_2nd"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="="
android:textSize="16sp"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:inputType="number"
android:maxLength="4"
android:hint=" "
android:id="#+id/third_ans"
android:imeOptions="flagNoExtractUi"
android:layout_marginRight="20dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:layout_gravity="center_horizontal"
android:id="#+id/third_true_ans"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:gravity="bottom"
android:layout_gravity="center_horizontal"
android:id="#+id/third_false_ans"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check"
android:layout_marginLeft="20dp"
android:onClick="check3rd"
android:id="#+id/third_btn"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="41.735"
android:textSize="16sp"
android:id="#+id/fourth_1st"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="+"
android:textSize="16sp"
/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="23.836"
android:textSize="16sp"
android:id="#+id/fourth_2nd"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="="
android:textSize="16sp"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:inputType="numberDecimal"
android:hint=" "
android:maxLength="7"
android:id="#+id/fourth_ans"
android:imeOptions="flagNoExtractUi"
android:layout_marginRight="20dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:layout_gravity="center_horizontal"
android:id="#+id/fourth_true_ans"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:gravity="bottom"
android:layout_gravity="center_horizontal"
android:id="#+id/fourth_false_ans"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check"
android:layout_marginLeft="20dp"
android:onClick="check4th"
android:id="#+id/fourth_btn"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="71.159"
android:textSize="16sp"
android:id="#+id/fifth_1st"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="-"
android:textSize="16sp"
/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="14.704"
android:textSize="16sp"
android:id="#+id/fifth_2nd"/>
<TextView
android:layout_width="70dp"
android:layout_height="wrap_content"
android:text="="
android:textSize="16sp"
/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:inputType="numberDecimal"
android:maxLength="7"
android:hint=" "
android:id="#+id/fifth_ans"
android:imeOptions="flagNoExtractUi"
android:layout_marginRight="20dp"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:layout_gravity="center_horizontal"
android:id="#+id/fifth_true_ans"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textSize="16dp"
android:gravity="bottom"
android:layout_gravity="center_horizontal"
android:id="#+id/fifth_false_ans"/>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check"
android:layout_marginLeft="20dp"
android:onClick="check5th"
android:id="#+id/fifth_btn"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
You can combine imeOptions with a | (pipe)
android:imeOptions="flagNoExtractUi|actionDone"

Scrollbar not displaying on opening softkeyboard

My fragment consists of ScrollView.Initially the content of fragment is able to fit in screen so there is no need of scrollbar.But when i open softkeyboard half the content is hidden behind keyboard so i want that scrollbar should be displayed.But it is not displaying.I tried putting below line in manifest but same result-
android:windowSoftInputMode="stateVisible|adjustResize"
Code-
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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"
android:background="#color/white"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/post_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/rel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone">
<EditText
android:id="#+id/ns"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:hint="News Source Link*"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:background="#drawable/edittextbordergrey"
android:text=""
android:textColor="#color/cwTextPrimaryColor"
android:textColorHint="#color/actiontext"
android:textSize="14sp"
android:textCursorDrawable="#null"
android:singleLine="true" />
<TextView
android:id="#+id/autofill_text_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ns"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:singleLine="true"
android:text="Auto fill"
android:textSize="14sp"
android:textColor="#color/username" />
<EditText
android:id="#+id/headline_edit_text"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="left"
android:hint="Headline that explains the real story*"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:textCursorDrawable="#null"
android:background="#drawable/edittextbordergrey"
android:text=""
android:layout_below="#+id/autofill_text_count"
android:textColor="#color/cwTextPrimaryColor"
android:textColorHint="#color/actiontext"
android:textSize="14sp"
android:maxLines="4"
android:scrollHorizontally="false"
android:maxLength="99" />
<TextView
android:id="#+id/headline_text_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/headline_edit_text"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:singleLine="true"
android:text="99 characters"
android:textSize="14sp"
android:textColor="#color/cwAccentColor" />
<RegularEditText
android:id="#+id/source_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:hint="Source*"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:background="#drawable/edittextbordergrey"
android:text=""
android:textCursorDrawable="#null"
android:textColor="#color/cwTextPrimaryColor"
android:layout_below="#+id/headline_text_count"
android:textColorHint="#color/actiontext"
android:textSize="14sp"
android:singleLine="true"
android:maxLength="25" />
<TextView
android:id="#+id/source_text_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/source_edit_text"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:singleLine="true"
android:text="25 characters"
android:textSize="14sp"
android:textColor="#color/cwAccentColor" />
<EditText
android:id="#+id/news_image_link_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittextbordergrey"
android:gravity="left"
android:hint="Link to picture or upload below"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:layout_below="#+id/source_text_count"
android:text=""
android:textColor="#color/cwTextPrimaryColor"
android:textColorHint="#color/actiontext"
android:textSize="14sp"
android:textCursorDrawable="#null"
android:singleLine="true"
android:visibility="visible" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/top10s_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone">
<RelativeLayout
android:id="#+id/top10s_headline_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittextbordergrey"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp">
<TextView
android:id="#+id/top10s_headline_default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:singleLine="true"
android:text="Top 10 "
android:textSize="15sp"
android:textColor="#color/cwTextPrimaryColor" />
<EditText
android:id="#+id/top10s_headline_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="15dp"
android:paddingLeft="60dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:singleLine="true"
android:textCursorDrawable="#null"
android:background="#android:color/transparent"
android:text=""
android:textColor="#color/cwTextPrimaryColor"
android:textColorHint="#color/actiontext"
android:textSize="14sp"
android:maxLength="93" />
</RelativeLayout>
<TextView
android:id="#+id/top10s_headline_text_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/top10s_headline_layout"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:singleLine="true"
android:text="93 characters"
android:textSize="14sp"
android:textColor="#color/cwAccentColor" />
<TextView
android:id="#+id/infoText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/top10s_image_link_edit_text"
android:layout_marginTop="8dp"
android:gravity="center"
android:textSize="16sp"
android:visibility="gone"
android:maxLines="2"
android:text="Be sure to add an image before hitting "Post""/>
<EditText
android:id="#+id/top10s_image_link_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:hint="Link to picture or upload below*"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:background="#drawable/edittextbordergrey"
android:text=""
android:textCursorDrawable="#null"
android:textColor="#color/cwTextPrimaryColor"
android:layout_below="#+id/top10s_headline_text_count"
android:textColorHint="#color/actiontext"
android:textSize="14sp"
android:singleLine="true"
android:visibility="visible" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/openhumor_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone">
<EditText
android:id="#+id/openhumor_funny_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:background="#drawable/edittextbordergrey"
android:singleLine="true"
android:textCursorDrawable="#null"
android:text=""
android:textColor="#color/cwTextPrimaryColor"
android:textColorHint="#color/actiontext"
android:textSize="14sp"
android:maxLength="93" />
<TextView
android:id="#+id/openhumor_funny_edit_text_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/openhumor_funny_edit_text"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:singleLine="true"
android:text="93 characters"
android:textSize="14sp"
android:textColor="#color/cwAccentColor" />
<EditText
android:id="#+id/openhumor_image_link_edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:hint="Link to picture or upload below*"
android:paddingBottom="15dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:background="#drawable/edittextbordergrey"
android:text=""
android:textCursorDrawable="#null"
android:textColor="#color/cwTextPrimaryColor"
android:layout_below="#+id/openhumor_funny_edit_text_count"
android:textColorHint="#color/actiontext"
android:textSize="14sp"
android:singleLine="true"
android:visibility="visible" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/post_layout"
android:layout_marginTop="15dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:layout_alignParentRight="true"
android:orientation="horizontal">
<ImageView
android:id="#+id/upload_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/camera_icon"
android:layout_marginRight="10dp"
android:padding="7dp"
android:layout_toLeftOf="#+id/post_button"
android:visibility="gone" />
<TextView
android:id="#+id/upload_image_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_toLeftOf="#+id/upload_image"
android:singleLine="true"
android:text=""
android:visibility="gone"
android:textColor="#color/white" />
<TextButton
android:id="#+id/post_button"
android:layout_width="65dp"
android:layout_height="35dp"
android:layout_alignParentRight="true"
android:background="#drawable/cancel_button_bg"
android:text="Post"
android:textAllCaps="false"
android:textColor="#color/white"
android:textSize="14sp"
android:visibility="gone" />
</RelativeLayout>
<ImageView
android:id="#+id/preview_imageview"
android:layout_width="140dp"
android:layout_height="90dp"
android:layout_below="#+id/post_layout"
android:layout_marginTop="15dp"
android:layout_marginLeft="5dp"
android:scaleType="centerCrop"
android:layout_marginRight="5dp" />
<ImageView
android:id="#+id/preview_imageview_delete"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_below="#+id/post_layout"
android:layout_alignRight="#+id/preview_imageview"
android:layout_alignTop="#+id/preview_imageview"
android:scaleType="centerCrop"
android:layout_marginRight="-10dp"
android:layout_marginTop="-10dp"
android:src="#drawable/preview_image_delete"
android:visibility="gone" />
</RelativeLayout>
</RelativeLayout>
<View
android:id="#+id/empty_action"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/black"
android:alpha="0.7"
android:visibility="gone" />
<ProgressBar
android:id="#+id/progress"
android:layout_width="#dimen/loading_view_progress_size"
android:layout_height="#dimen/loading_view_progress_size"
android:layout_marginRight="#dimen/loading_view_margin_right"
style="?android:progressBarStyle"
android:indeterminate="true"
android:layout_centerInParent="true"
android:visibility="gone" />
</RelativeLayout>
</ScrollView>

ScrollView with RelativeLayout dont scroll to end

i have a ScrollView in android, inside it i have a RelativeLayout, my problem its the scroll doesnt go to the end and i cant see the last TextView.
This is the XML
<!-- Main layout -->
<LinearLayout 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"
tools:context=".TabOrderActivity$OrderDetailFragment"
android:orientation="vertical"
android:background="#drawable/fondodroid2"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
android:weightSum="1">
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue_gg"
android:paddingTop="5dip">
<TextView
android:text="#string/orderDetail"
android:textSize="32sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:textColor="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:orientation="horizontal">
<TextView
android:text="Nº"
android:textSize="28sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp" />
<TextView
android:id="#+id/file"
android:textSize="28sp"
android:layout_marginLeft="20dp"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="10dp"
android:layout_weight="2.16"
android:layout_marginRight="0dp"
android:text="numero de orden" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:id="#+id/scrollView">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
<TextView
android:id="#+id/policyHolderLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/customer"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="24dp"
android:layout_alignParentLeft="true"
android:layout_marginTop="0dp"
android:textStyle="bold" />
<TextView
android:id="#+id/policyHolder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_toRightOf="#+id/policyHolderLabel"
android:gravity="left|top"
android:layout_marginLeft="10dp"
android:textSize="20sp" />
<TextView
android:id="#+id/cityLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/city"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/policyHolder"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/city"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_toRightOf="#+id/cityLabel"
android:gravity="left|top"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/cityLabel" />
<TextView
android:id="#+id/provinceLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/province"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/city"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/province"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/provinceLabel"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/provinceLabel" />
<TextView
android:id="#+id/addressLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:layout_below="#+id/province"
android:layout_alignParentLeft="true"
android:textStyle="bold" />
<TextView
android:id="#+id/address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/addressLabel"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_alignBottom="#+id/addressLabel" />
<TextView
android:id="#+id/zipCode"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_toRightOf="#+id/addressLabel"
android:layout_below="#+id/address"
android:layout_marginLeft="10dp" />
<TextView
android:id="#+id/phonesLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/phones"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:layout_below="#+id/zipCode"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/phone1"
android:inputType="phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|top"
android:textSize="20sp"
android:layout_toRightOf="#+id/phonesLabel"
android:layout_marginLeft="10dp"
android:layout_alignBottom="#+id/phonesLabel" />
<TextView
android:id="#+id/descriptionLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/description"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/phonesLabel"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/descriptionLabel"
android:layout_below="#+id/descriptionLabel"
android:layout_marginTop="10dp"
android:editable="false"
android:inputType="textMultiLine"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="20sp"
android:layout_marginBottom="10dp" />
<TextView
android:id="#+id/coverageLabel"
style="#style/orderHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Cobertura"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_below="#+id/description"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:gravity="left|top"
android:textSize="24dp"
android:textStyle="bold" />
<TextView
android:id="#+id/coverage"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/coverageLabel"
android:layout_below="#+id/coverageLabel"
android:layout_marginTop="10dp"
android:editable="false"
android:inputType="textMultiLine"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="left|top"
android:textSize="20sp"
android:layout_marginBottom="10dp" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
I tried to set a LinearLayout inside scrollview and the linearlayout contains the relative but i got the same result.
Whats wrong?
Try to change the margins to paddings:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
Hope this helps.

Categories

Resources