Scrollbar not displaying on opening softkeyboard - android

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>

Related

ScrollView is failing to scroll its child layout

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>

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);

Scrollview is not working when a linear layout inside it

I just put a linear layout inside a scrollview dont know why its not working.
When the keyboard is open the scrollbar is not showing at all. When i move one text box to another there is a submit button which is not show when i run on small size devices.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/layoutPopUp"
android:layout_width="match_parent"
android:layout_height="79dp"
android:background="#F57F20"
android:paddingBottom="20dp"
android:paddingTop="20dp"
android:visibility="visible">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<LinearLayout
android:id="#+id/backlayout"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:orientation="horizontal">
<ImageButton
android:id="#+id/btnBackbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:background="#color/transparent"
android:gravity="center"
android:src="#drawable/back"
android:visibility="visible" />
<TextView
android:id="#+id/textBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:gravity="center"
android:text="Back"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="15sp" />
</LinearLayout>
<TextView
android:id="#+id/textTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.6"
android:gravity="center"
android:text="Contact Us"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="20sp"
android:textStyle="bold" />
<ImageButton
android:id="#+id/imagePopUp"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.2"
android:background="#color/transparent"
android:gravity="center"
android:src="#drawable/menu"
android:visibility="visible" />
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/editTextName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/editboxshap"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#2b2b2b"
android:textColorHint="#2b2b2b"
android:textCursorDrawable="#color/black">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/editboxshap"
android:ems="10"
android:hint="Phone No."
android:inputType="phone"
android:maxLength="12"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#2b2b2b"
android:textColorHint="#2b2b2b"
android:textCursorDrawable="#color/black" />
<EditText
android:id="#+id/editEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/editboxshap"
android:ems="10"
android:hint="E-mail"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#2b2b2b"
android:textColorHint="#2b2b2b"
android:textCursorDrawable="#color/black" />
<EditText
android:id="#+id/editComment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/editboxshap"
android:ems="10"
android:gravity="start"
android:hint="Comments"
android:inputType="textMultiLine"
android:lines="3"
android:maxLength="500"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#2b2b2b"
android:textColorHint="#2b2b2b"
android:textCursorDrawable="#color/black" />
<Button
android:id="#+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="20dp"
android:background="#drawable/button_shape"
android:text="SUBMIT"
android:textColor="#color/white" />
</LinearLayout>
</ScrollView>
</LinearLayout>
try to put scrollview inside another linear layout and try
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/parentLin"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="//define in dp"
android:scrollbars="vertical"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/editTextName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/editboxshap"
android:textColorHint="#2b2b2b"
android:textColor="#2b2b2b"
android:ems="10"
android:hint="Name"
android:inputType="textPersonName"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium">
<requestFocus />
</EditText>
<EditText
android:id="#+id/editPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/editboxshap"
android:ems="10"
android:textColor="#2b2b2b"
android:hint="Phone No."
android:inputType="phone"
android:textColorHint="#2b2b2b"
android:maxLength="12"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/editboxshap"
android:textColor="#2b2b2b"
android:ems="10"
android:textColorHint="#2b2b2b"
android:hint="E-mail"
android:inputType="textEmailAddress"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/editComment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/editboxshap"
android:ems="10"
android:gravity="start"
android:textColor="#2b2b2b"
android:hint="Comments"
android:textColorHint="#2b2b2b"
android:inputType="textMultiLine"
android:lines="3"
android:maxLength="500"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center">
<Button
android:id="#+id/btnSubmit"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/button_shape"
android:text="SUBMIT"
android:textColor="#color/white" />
</RelativeLayout>
</RelativeLayout>
and You have to specify the following line of code in the manifest file with your activity
android:windowSoftInputMode="adjustResize"
try This.. on your activity / fragment
getActivity().getWindow()
.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE |
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

Android SDK: RelativeLayout - Button WILL NOT center horizontally, even with Layout_CenterHorizontal=true

I really hope somebody can help me here because I am going to start pulling my hair out if this keeps doing what it's doing.
I'm trying to design a layout and I want all of my stuff to be centered. So far, everything is. However, the Save button I created will not center itself for the life of it. It consistently aligns its left edge with the center of the screen, rather than the center of the button itself.
Below is a screenshot of my simple design and the xml behind it... Any help will be GREATLY appreciated!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_settings"
tools:context="com.hypertom.weeklymealgenerator.SettingsActivity"
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="#string/strSettingsTitle"
android:id="#+id/textView"
android:textIsSelectable="false"
android:textSize="30sp"
android:layout_alignParentTop="true"
android:layout_alignStart="#+id/textView2" />
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/strSettingsNumMeals"
android:id="#+id/textView2"
android:layout_below="#+id/textView"
android:layout_alignParentStart="true"
android:layout_marginTop="40dp"
android:layout_marginLeft="10dp"
android:gravity="right"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/strSettingsThresholdMin"
android:id="#+id/textView3"
android:layout_below="#+id/textView2"
android:layout_alignEnd="#+id/textView2"
android:layout_marginTop="10dp"
android:gravity="right"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/strSettingsThresholdMax"
android:id="#+id/textView4"
android:layout_below="#+id/textView3"
android:layout_alignEnd="#+id/textView3"
android:layout_marginTop="10dp"
android:gravity="right"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/strSettingsNumServings"
android:id="#+id/textView5"
android:layout_below="#+id/textView4"
android:layout_alignEnd="#+id/textView4"
android:layout_marginTop="10dp"
android:gravity="right"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/strSettingsNumSubstitutes"
android:id="#+id/textView6"
android:layout_below="#+id/textView5"
android:layout_alignEnd="#+id/textView5"
android:layout_marginTop="10dp"
android:gravity="right"
android:textSize="18sp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/btnSettingsSave"
android:id="#+id/button4"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="200dp" />
<EditText
android:layout_width="65dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/editText"
android:layout_alignBottom="#+id/textView2"
android:layout_toEndOf="#+id/textView2"
android:layout_marginBottom="-12dp"
android:textSize="18sp"
android:gravity="center" />
<EditText
android:layout_width="65dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/editText2"
android:layout_alignBottom="#+id/textView3"
android:layout_alignStart="#+id/editText"
android:textSize="18sp"
android:layout_marginBottom="-12dp"
android:gravity="center" />
<EditText
android:layout_width="65dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/editText3"
android:layout_above="#+id/textView5"
android:layout_alignStart="#+id/editText2"
android:layout_marginBottom="-12dp"
android:textSize="18sp"
android:gravity="center" />
<EditText
android:layout_width="65dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/editText4"
android:layout_above="#+id/textView6"
android:layout_alignStart="#+id/editText3"
android:textSize="18sp"
android:layout_marginBottom="-12dp"
android:gravity="center" />
<EditText
android:layout_width="65dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/editText5"
android:layout_alignBottom="#+id/textView6"
android:layout_alignStart="#+id/editText4"
android:layout_marginBottom="-12dp"
android:textSize="18sp"
android:gravity="center" />
</RelativeLayout>
Something like this ? It can be done much easier in LinearLayout though.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerInParent="true"
android:text="strSettingsTitle"
android:layout_marginTop="20dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textIsSelectable="false"
android:textSize="30sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView"
android:layout_marginTop="20dp"
android:orientation="horizontal"
android:id="#+id/linearlayout">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_margin="10dp"
android:layout_centerInParent="true">
<TextView
android:id="#+id/textView2"
android:layout_width="match_parent"
android:layout_height="30dp"
android:text="# of Meals"
android:gravity="right"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="18sp" />
<TextView
android:id="#+id/textView3"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="#+id/textView2"
android:layout_marginTop="10dp"
android:gravity="right"
android:text="Threshold Min"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="18sp" />
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="#+id/textView3"
android:layout_marginTop="10dp"
android:gravity="right"
android:text="Threshold Max"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="18sp" />
<TextView
android:id="#+id/textView5"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_below="#+id/textView4"
android:gravity="right"
android:layout_marginTop="10dp"
android:text="Num of Servings"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="18sp" />
<TextView
android:id="#+id/textView6"
android:layout_width="match_parent"
android:gravity="right"
android:layout_height="30dp"
android:layout_below="#+id/textView5"
android:layout_marginTop="10dp"
android:text="Num of Substitutes"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="18sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_margin="10dp">
<EditText
android:id="#+id/editText"
android:layout_width="65dp"
android:layout_height="30dp"
android:ems="10"
android:inputType="number"
android:textSize="18sp" />
<EditText
android:id="#+id/editText2"
android:layout_width="65dp"
android:layout_height="30dp"
android:layout_marginTop="10dp"
android:layout_below="#+id/editText"
android:ems="10"
android:inputType="number"
android:textSize="18sp" />
<EditText
android:id="#+id/editText3"
android:layout_width="65dp"
android:layout_height="30dp"
android:layout_below="#+id/editText2"
android:layout_marginTop="10dp"
android:ems="10"
android:inputType="number"
android:textSize="18sp" />
<EditText
android:id="#+id/editText4"
android:layout_width="65dp"
android:layout_height="30dp"
android:layout_below="#+id/editText3"
android:layout_marginTop="10dp"
android:ems="10"
android:inputType="number"
android:textSize="18sp" />
<EditText
android:id="#+id/editText5"
android:layout_width="65dp"
android:layout_height="30dp"
android:layout_below="#+id/editText4"
android:layout_marginTop="10dp"
android:ems="10"
android:inputType="number"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<Button
android:id="#+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_centerInParent="true"
android:layout_below="#+id/linearlayout"
android:text="Save" />
</RelativeLayout>

How to use scroll view in relative layout which exist in fragment?

i am stuck how to scroll layout when keyboard appear? this is my static page but when my keyboard appear then my scrollview is not working.i can not give hard code height of scrollview. please help me..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/settingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/splash_bg" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
</ScrollView>
Please help me out.
suggestions apreciated
Thanks Kind Regards.
Try this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/splash_bg" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
And add this code to ypur manifest project:
<activity
android:name="YourActivity"
android:windowSoftInputMode="stateVisible|stateAlwaysVisible" >
</activity>
add this code in ur manifest activty
android:windowSoftInputMode="adjustPan|stateAlwaysVisible"
this code useful for scrolling relative layout..
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="#+id/settingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/splash_bg" >
<ImageView
android:id="#+id/tree_iv_userSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/tree_transparent" />
<ImageView
android:id="#+id/image1"
android:layout_width="90dp"
android:layout_height="110dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:src="#drawable/frame_large" />
<TextView
android:id="#+id/changepassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/image1"
android:layout_marginLeft="20dp"
android:background="#android:color/transparent"
android:hint="CHANGE PASSWORD"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/changepassword"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT NAME"
android:maxLength="20"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<EditText
android:id="#+id/editphoneno"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editname"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:hint="EDIT PHONE NUMBER"
android:maxLength="15"
android:numeric="integer"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColorHint="#android:color/black" />
<TextView
android:id="#+id/edittype"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/editphoneno"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="EDIT TYPE"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/edittype"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp"
android:background="#android:color/transparent"
android:singleLine="true"
android:text="NOTIFICATION"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black" />
<Button
android:id="#+id/togNot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/save"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:background="#drawable/on_button" />
<TextView
android:id="#+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/notification"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#android:color/transparent"
android:text="SAVE "
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#android:color/black"
android:textSize="40dp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/image1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="27dp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/bottomRelay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="7.5dp"
android:background="#android:color/transparent"
android:visibility="gone" >
<TextView
android:id="#+id/Upload"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#ededed"
android:gravity="center"
android:text="Upload Photo"
android:textColor="#8F8F8F"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border1"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/Upload"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/choose_existing"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border1"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="1dp"
android:background="#ededed"
android:gravity="center"
android:text="Library"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/choose_existing"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/Camera"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border2"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="1dp"
android:background="#ededed"
android:gravity="center"
android:text="Camera"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
<ImageView
android:id="#+id/border3"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#id/Camera"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#939393" />
<TextView
android:id="#+id/cancel"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/border3"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="20dp"
android:background="#ededed"
android:gravity="center"
android:text="Cancel"
android:textColor="#007AFF"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>

Categories

Resources