Can't put the list view under the text view - android

This is my relative layout right now:
http://prntscr.com/d9yure
All I want is deleteList be under the deleteUsersTxt, but it doesn't let me. It only allows me to put it below invitation list. I have tried to add to it android:layout_below="#+id/deleteUsersTxt" but it just makes it dissapear.
This is the XML:
<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" android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context="meet.projectoklahoma.Activities.CreateEventActivity">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/invitaionsList"
android:layout_above="#id/deleteUsersTxt"
android:choiceMode="multipleChoice"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/addUsersTxt" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/other"
android:id="#+id/otherButton"
android:onClick="setDate"
android:layout_alignTop="#+id/tomorrowButton"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/which_day"
android:id="#+id/whichDayTxt"
android:layout_below="#+id/eventNameTextBox"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/tomorrow"
android:id="#+id/tomorrowButton"
android:onClick="tomorrow"
android:layout_alignTop="#+id/todayButton"
android:layout_toRightOf="#+id/otherButton"
android:layout_toEndOf="#+id/otherButton" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="whichDay"
android:id="#+id/dayTxt"
android:layout_below="#+id/whichDayTxt"
android:layout_alignRight="#+id/whichDayTxt"
android:layout_alignEnd="#+id/whichDayTxt" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="date"
android:id="#+id/dateTxt"
android:layout_below="#+id/dayTxt"
android:layout_alignRight="#+id/dayTxt"
android:layout_alignEnd="#+id/dayTxt" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/which_time"
android:id="#+id/timeTxt"
android:layout_below="#+id/dateTxt"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/choose_time"
android:id="#+id/whichTimeBtn"
android:layout_alignTop="#+id/timeTxt"
android:layout_alignLeft="#+id/todayButton"
android:layout_alignStart="#+id/todayButton"
android:onClick="setTime"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="whichTime"
android:id="#+id/whichTimeTxt"
android:layout_below="#+id/timeTxt"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="#string/add_users_to_event"
android:id="#+id/addUsersTxt"
android:layout_below="#+id/whichTimeBtn"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/today"
android:id="#+id/todayButton"
android:onClick="today"
android:layout_alignBottom="#+id/dayTxt"
android:layout_toLeftOf="#+id/timeTxt"
android:layout_toStartOf="#+id/timeTxt" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/eventNameTextBox"
android:text="שם האירוע"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:text="הסרת משתמשים מהאירוע:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/deleteUsersTxt"
android:layout_marginBottom="131dp"
android:layout_above="#+id/cancelAndDeleteButton"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/delete_and_cancel"
android:id="#+id/cancelAndDeleteButton"
android:onClick="deleteEvent"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="סבבה"
android:id="#+id/SaveEventButton"
android:onClick="editEvent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/deleteList"
android:layout_below="#+id/invitaionsList"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
Is there a minimum space for a list to be in?

Here is not something but everything goes wrong.
You can use LinearLayout (with vertical orientation) as your root layout to make it easy.
Then it will become more easy to understand for you.

Try grouping them inside of a LinearLayout and split them equally, like this:
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_above="#id/deleteUsersTxt"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/addUsersTxt"
android:layout_height="wrap_content">
<ListView
android:layout_width="match_parent"
android:layout_height="0dp"
android:id="#+id/invitaionsList"
android:layout_weight="1"
android:choiceMode="multipleChoice" />
<ListView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/deleteList"/>
</LinearLayout>

Related

List View inside relative layout and scroll view not covering screen

I have below layout
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/searchScreenBG">
<RelativeLayout
android:id="#+id/title_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="#dimen/_7sdp">
<ImageButton
android:id="#+id/ib_hamburger"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="#dimen/_16sdp"
android:layout_marginRight="#dimen/_16sdp"
android:layout_marginTop="#dimen/_15sdp"
android:background="#android:color/transparent"
android:contentDescription="#null"
app:srcCompat="#drawable/ham_burger" />
<com.rod.com.rod.ui.views.CTextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/ib_hamburger"
android:layout_centerHorizontal="true"
android:text="#string/basic_details"
android:textColor="#color/colorGreen" />
<ImageButton
android:id="#+id/ib_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignTop="#+id/ib_hamburger"
android:layout_marginLeft="#dimen/_16sdp"
android:layout_marginStart="#dimen/_16sdp"
android:background="#android:color/transparent"
android:contentDescription="#null"
app:srcCompat="#drawable/left_arrow" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/reg_no_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/_5sdp"
android:layout_below="#+id/title_bar"
android:background="#color/colorWhite">
<TextView
android:id="#+id/tv_reg_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:textColor="#color/colorLightGrey" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/reg_no_layout"
>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_marginRight="#dimen/_10sdp"
android:layout_marginLeft="#dimen/_10sdp"
android:layout_weight="1">
<RelativeLayout
android:id="#+id/basic_details"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="#dimen/_10sdp"
android:background="#drawable/list_item_bg"
android:paddingBottom="#dimen/_10sdp">
<TextView
android:id="#+id/tv_district_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="50dp"
android:layout_marginStart="50dp"
android:layout_marginTop="11dp"
android:text="#string/district"
android:textColor="#color/colorBlack"
android:textSize="#dimen/_13sdp" />
<TextView
android:id="#+id/tv_district"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tv_district_label"
android:layout_alignStart="#+id/tv_district_label"
android:layout_below="#+id/tv_district_label"
android:text="TextView"
android:textColor="#color/colorLightGrey" />
<TextView
android:id="#+id/tv_tehsil_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/tv_district"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="75dp"
android:layout_marginRight="75dp"
android:text="#string/tehsil"
android:textColor="#color/colorBlack" />
<TextView
android:id="#+id/tv_tehsil"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/tv_district"
android:layout_alignLeft="#+id/tv_tehsil_label"
android:layout_alignStart="#+id/tv_tehsil_label"
android:text="TextView"
android:textColor="#color/colorLightGrey" />
<TextView
android:id="#+id/tv_date_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tv_district"
android:layout_alignStart="#+id/tv_district"
android:layout_below="#+id/tv_district"
android:layout_marginTop="13dp"
android:text="#string/date"
android:textColor="#color/colorBlack" />
<TextView
android:id="#+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tv_date_label"
android:layout_alignStart="#+id/tv_date_label"
android:layout_below="#+id/tv_date_label"
android:text="TextView"
android:textColor="#color/colorLightGrey" />
<TextView
android:id="#+id/tv_jild_no_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/tv_date_label"
android:layout_alignLeft="#+id/tv_tehsil"
android:layout_alignStart="#+id/tv_tehsil"
android:text="#string/jild_no"
android:textColor="#color/colorBlack" />
<TextView
android:id="#+id/tv_jild_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tv_jild_no_label"
android:layout_alignStart="#+id/tv_jild_no_label"
android:layout_below="#+id/tv_jild_no_label"
android:text="TextView"
android:textColor="#color/colorLightGrey" />
<TextView
android:id="#+id/tv_party_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tv_date"
android:layout_alignStart="#+id/tv_date"
android:layout_below="#+id/tv_date"
android:layout_marginTop="13dp"
android:text="#string/party"
android:textColor="#color/colorBlack" />
<TextView
android:id="#+id/tv_party"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/tv_party_label"
android:layout_alignStart="#+id/tv_party_label"
android:layout_below="#+id/tv_party_label"
android:text="TextView"
android:textColor="#color/colorLightGrey" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:layout_below="#+id/basic_details"
android:layout_marginTop="13dp"
android:background="#drawable/list_item_bg">
<TextView
android:id="#+id/tv_member_details_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="#dimen/_40sdp"
android:layout_marginStart="#dimen/_40sdp"
android:layout_marginTop="14dp"
android:text="#string/member_details"
android:textColor="#color/colorBlack"
android:textSize="#dimen/_16sdp" />
<ListView
android:id="#+id/lv_members"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/tv_member_details_label"
android:layout_marginLeft="#dimen/_40sdp"
android:layout_marginRight="#dimen/_40sdp"
android:layout_marginStart="#dimen/_40sdp"
android:layout_marginTop="16dp"
android:divider="#color/colorLightGrey"
android:dividerHeight="#dimen/_1sdp" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
</FrameLayout>
I want to make the relative layout below basic_layout cover the whole of the rest screen. How can I achieve that. After searching I had found that I should put a linear layout inside my scroll view, and then relative layouts should added. But that's of no help.
I want hierachy something like below:
----RelativeLayout
-------TitleBar
-------TextView
-------ScrollView (rest of screen)
----------RelativeLayout (upper portion of scroll view)
------------TextViews
----------RelativeLayout (rest of scrol view)
-------------TextView
-------------ListView
Any help please?
Actually the problem is that you are using 2 layouts in your scrollview so the listview won't take the scroll of itself and it will limit the list height as well. To go around this you need to pass fix value to your listview then it will show completely within that specified height. And the rest of the layout if you want to get exactly as you have shown in the picture you need to use cardview instead.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:layout_below="#+id/basic_details"
android:layout_marginTop="13dp"
android:layout_marginBottom="10dp"
android:background="#drawable/list_item_bg">
<TextView
android:id="#+id/tv_member_details_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="#dimen/_40sdp"
android:layout_marginStart="#dimen/_40sdp"
android:layout_marginTop="14dp"
android:text="#string/member_details"
android:textColor="#color/colorBlack"
android:textSize="16dp" />
<ListView
android:id="#+id/lv_members"
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/tv_member_details_label"
android:layout_marginLeft="#dimen/_40sdp"
android:layout_marginRight="#dimen/_40sdp"
android:layout_marginStart="#dimen/_40sdp"
android:layout_marginTop="16dp"
android:divider="#color/colorLightGrey"
android:dividerHeight="#dimen/_1sdp" />
</RelativeLayout>

How to set my scrollView layout height to the top of a fragment

I have an app where the scrolView (relative layout inside it) take up the whole screen (fill_parent). But instead of ending at the end of the phone i would like to have a fragment at the bottom and have the ScrollView layout to stop at the top of the fragment. I think it probably has to do with the height but can't really figure out the code. Please look at my imgur image to get my idea. Imgur_Image, press here
<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="wrap_content"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"><![CDATA[
tools:context="c.timno.smsgsm.MainActivity">
]]>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="status?"
android:id="#+id/skicka"
android:hint="Status?"
android:layout_marginTop="38dp"
android:layout_below="#+id/buttonanvandare"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="på"
android:id="#+id/skickaaon"
android:layout_marginEnd="36dp"
android:layout_below="#+id/textViewlarm"
android:layout_alignEnd="#+id/skicka" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Av"
android:id="#+id/skickaaoff"
android:layout_below="#+id/textViewlarm"
android:layout_toEndOf="#+id/skickarela1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Relä 1"
android:id="#+id/skickarela1"
android:layout_alignTop="#+id/skickarela2"
android:layout_alignStart="#+id/skickaaon" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Relä 2"
android:id="#+id/skickarela2"
android:layout_below="#+id/textView"
android:layout_toEndOf="#+id/skickarela1" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Aktivera"
android:gravity="center"
android:textSize="29dp"
android:id="#+id/textView"
android:layout_below="#+id/skickaaon"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Larm"
android:textSize="29dp"
android:id="#+id/textViewlarm"
android:layout_below="#+id/skicka"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Avaktivera"
android:textSize="29dp"
android:id="#+id/textView3"
android:autoText="false"
android:layout_below="#+id/textView"
android:layout_alignEnd="#+id/buttoninstallator"
android:layout_marginTop="46dp" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Relä 1"
android:id="#+id/skickatrela1off"
android:layout_below="#+id/textView3"
android:layout_toStartOf="#+id/skickatrela2off" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Relä 2"
android:id="#+id/skickatrela2off"
android:layout_alignTop="#+id/skickatrela1off"
android:layout_alignStart="#+id/skickarela2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Användare"
android:id="#+id/buttonanvandare"
android:layout_alignParentStart="true"
android:layout_toStartOf="#+id/skickaaoff" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Installation"
android:id="#+id/buttoninstallator"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_toEndOf="#+id/buttonanvandare" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="status?"
android:id="#+id/statustxt"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="aon"
android:id="#+id/aon"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="aoff"
android:id="#+id/aoff"
android:layout_alignParentStart="true"
android:layout_below="#+id/statustxt" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="on*1*"
android:id="#+id/rela1txxt"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="On*2*"
android:id="#+id/rela2onn"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="off*2*"
android:id="#+id/rela2offtxt"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="off*1*"
android:id="#+id/offrela1txt"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Värmestyrning"
android:textSize="33dp"
android:id="#+id/textView8"
android:layout_below="#+id/skickatrela1off"
android:layout_marginTop="25dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Komfortvärme"
android:textSize="29dp"
android:id="#+id/textView9"
android:layout_below="#+id/textView8" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Heaton"
android:id="#+id/btnHeaton"
android:layout_below="#+id/textView9"
android:layout_alignEnd="#+id/skickatrela1off" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Heatoff"
android:id="#+id/btnHeatoff"
android:layout_below="#+id/textView9"
android:layout_alignStart="#+id/skickatrela2off" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Underhållsvärme"
android:textSize="29dp"
android:id="#+id/textView10"
android:layout_below="#+id/btnHeaton"
android:layout_centerHorizontal="true" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Termon"
android:id="#+id/btnTermon"
android:layout_below="#+id/textView10"
android:layout_toStartOf="#+id/btnHeatoff" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Termoff"
android:id="#+id/btnTermoff"
android:layout_alignBottom="#+id/btnTermon"
android:layout_toEndOf="#+id/btnTermon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Heaton"
android:id="#+id/txtHeaton"
android:layout_alignTop="#+id/statustxt"
android:layout_alignEnd="#+id/statustxt" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Heatoff"
android:id="#+id/txtHeatoff"
android:layout_alignBottom="#+id/statustxt"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Termon"
android:id="#+id/txtTermon"
android:layout_alignBaseline="#+id/aoff"
android:layout_alignBottom="#+id/aoff"
android:layout_alignEnd="#+id/statustxt" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Termoff"
android:id="#+id/txtTermoff"
android:layout_alignTop="#+id/statustxt"
android:layout_alignEnd="#+id/txtHeatoff" />
<fragment
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:name="c.timno.smsgsm20.SecondFragment"
android:id="#+id/fragmentsms"
android:layout_below="#+id/textView8"
android:layout_alignParentStart="true"
tools:layout="#layout/second_layout"
android:layout_above="#+id/textView10" />
</RelativeLayout>
</ScrollView>
I would suggest putting the ScrollView and the Fragment inside a new top-level element and then using the respective method within that element to adjust the size and position of each.
For instance, using a RelativeLayout:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
...>
<ScrollView
android:id="#+id/scrollview"
android:layout_above="#+id/frag"
android:layout_width="match_parent"
android:layout_height="match_parent"
...>
<RelativeLayout
android:paddingBottom="50dp"
...>
...
</RelativeLayout>
...
</ScrollView>
<Fragment
android:id="#+id/frag"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="50dp"
...>
...
</Fragment>
</RelativeLayout>
(Note that the padding on the bottom of the RelativeLayout inside the ScrollView matches the height of the Fragment so that contents of the ScrollView don't get hidden behind the Fragment)
You could also do this using LinearLayout as the parent element with an attribute of android:orientation="vertical", and the ScrollView and Fragment each getting an appropriate layout_weight attribute, but that's not as clean imho, so I'll leave it to you if you'd prefer to do that.
<ScrollView>
<RelativeLayout>
//main content
</RelativeLayout>
<FrameLayout android:alignParentBottom="true"/> load fragment here dynamically(or not)
</ScrollView>
This worked for me. Check this question out aswell

Scrollview not working properly.Screen doesn't scroll when input keyboards up

XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="#layout/toolbar"/>
<ScrollView
android:id="#+id/scroll"
android:layout_width="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_height="wrap_content"
android:layout_above="#+id/makeOffer"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="#+id/firstcard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
android:layout_marginTop="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<RelativeLayout
android:id="#+id/insidecardone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/constant_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/padding_4dp"
android:text="Charge per day"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/tvRentPerday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:hint="Rs. "
android:gravity="center"
android:inputType="number"
android:maxLength="4"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/insidecardtwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardone"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/con_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Duration (Days)"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/num_days"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center_horizontal"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_24dp"
android:text="10"
android:textSize="#dimen/text_size_big_16"
/>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_8dp"
android:background="#color/grey_lighter" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_4dp"
android:paddingBottom="#dimen/padding_8dp"
android:paddingTop="#dimen/padding_24dp">
<TextView
android:id="#+id/total_constant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="#dimen/padding_4dp"
android:gravity="center_vertical"
android:text="Total Amount"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/tvAmount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center_vertical"
android:textColor="#ff4f00"
android:textSize="#dimen/text_size_big_16"
android:textStyle="bold" />
<TextView
android:id="#+id/total_constant_mutterfly"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/total_constant"
android:paddingTop="#dimen/padding_4dp"
android:text="#string/process_fee_text"
android:textColor="#android:color/darker_gray"
android:textSize="8sp" />
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/middlecard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/firstcard"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<RelativeLayout
android:id="#+id/middlecard_relative"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_margin="#dimen/padding_4dp">
<TextView
android:id="#+id/deposite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="#dimen/padding_4dp"
android:gravity="center_vertical"
android:text="Deposit"
android:textSize="#dimen/text_size_big_16" />
<TextView
android:id="#+id/knowmore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/deposite"
android:text="#string/txt_know_more"
android:layout_marginTop="#dimen/padding_8dp"
android:textSize="#dimen/text_size_extra_extra_small_10"
/>
<CheckBox
android:id="#+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:inputType="number"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/middletwo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/middlecard_relative"
android:layout_margin="#dimen/padding_4dp"
android:visibility="gone"
>
<TextView
android:id="#+id/middle_con_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Charge (Rs.)"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/etDeposit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:gravity="center"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:hint="1000"
android:maxLength="4"
android:inputType="number"
android:textSize="#dimen/text_size_big_16"
/>
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id="#+id/seccard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/middlecard"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
app:cardCornerRadius="#dimen/padding_4dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/describe_constant_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/padding_8dp"
android:text="Describe Your item"
android:textColor="#ff4f00"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/rlTohide"
android:layout_marginTop="#dimen/padding_4dp"
android:layout_width="160dp"
android:layout_height="120dp"
android:background="#drawable/greyborder_transparentbg"
>
<ImageView
android:id="#+id/img1"
android:layout_centerInParent="true"
android:layout_width="40dp"
android:src="#drawable/addimg"
android:layout_height="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/img1"
android:text="(Optional)"
android:textSize="#dimen/text_size_extra_extra_small_10"
android:textColor="#color/text_grey_opc"
android:layout_centerInParent="true"
/>
</RelativeLayout>
<ImageView
android:visibility="gone"
android:id="#+id/imgResource"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_gravity="center"
android:layout_marginTop="#dimen/padding_8dp"
/>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp"
android:layout_marginTop="180dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardone"
android:layout_margin="#dimen/padding_4dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<TextView
android:id="#+id/con_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="8dp"
android:text="Name Of Product"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_toEndOf="#+id/con_product_name"
android:layout_toRightOf="#+id/con_product_name"
android:layout_alignParentRight="true"
android:hint="E.g. Nikon DSLR"
android:paddingEnd="#dimen/padding_16dp"
android:paddingRight="#dimen/padding_16dp"
android:maxLength="30"
android:inputType="textPersonName"
android:layout_marginLeft="#dimen/padding_16dp"
android:layout_marginStart="#dimen/padding_16dp"
android:textColor="#android:color/black"
android:textSize="#dimen/text_size_big_16"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/insidecardtwo"
android:layout_margin="#dimen/padding_4dp"
android:layout_marginBottom="#dimen/padding_8dp"
android:layout_marginLeft="#dimen/padding_8dp"
android:layout_marginRight="#dimen/padding_8dp">
<TextView
android:id="#+id/Description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Description :"
android:textSize="#dimen/text_size_big_16" />
<EditText
android:id="#+id/desc_box"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/Description"
android:hint="E.g. Comes with 18-55 mm lens, charger and carry case"
android:layout_marginTop="#dimen/padding_8dp"
android:background="#drawable/white_border_request_screen"
android:textColor="#android:color/darker_gray"
android:textSize="#dimen/text_size_big_16" />
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>
<Button
android:id="#+id/makeOffer"
android:layout_width="match_parent"
android:layout_height="#dimen/padding_48dp"
android:layout_alignParentBottom="true"
android:background="#color/new_primary_text"
android:padding="#dimen/padding_8dp"
android:text="#string/txt_make_offr"
android:textColor="#android:color/white"
android:textSize="#dimen/text_size_18"
/>
</RelativeLayout>
Android Manifest
<activity
android:name=".MyActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>
I am working on the layout since last night and I tried almost solution which I known. I am new in Android so please suggest me what is wrong with this layout.
this "fillViewport" work for another screen but with this screen it's not working.
Add android:windowSoftInputMode="stateHidden|adjustResize" to your <activity> tag in AndroidManifest.xml file. This will cause the screen to be resized to the left over space after the soft keyboard is shown. So, you will be able to scroll easily.
One more thing set property of ScrollView to the android:layout_above to the Button on the bottom of the page.
UpDate :
add this line to your ScrollView.
android:layout_above="#+id/makeOffer"
like this way
<ScrollView
android:id="#+id/scroll"
android:layout_width="wrap_content"
android:layout_below="#+id/toolbar"
android:layout_height="wrap_content"
android:fillViewport="true"
android:layout_above="#+id/makeOffer">
ScreenShot :

Scrollview that doesn't scroll

In order to view all the elements inside my relativelayout in smaller screens, I have made the choice to use a scrollview to make it possible (or at least to try to accomplish this). The problem: I'm unable to scroll. The result of having or not the scrollview is the same, if the screen is small some elements will get cut off (this was fine if scroll was possible). In some searches I have come across some scrollview with linearlayout implementations, but in my case I think it's not very good, because i need check boxes aligned to the right of text.
Heres the xml of what I got thus far:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#231E1A"
android:keepScreenOn="true"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:ignore="ContentDescription"
android:fillViewport="true">
<RelativeLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:id="#+id/btn_getDirections"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:text="#string/btn_getDirections" />
<TextView
android:id="#+id/static_language"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/radioGroup"
android:layout_alignLeft="#+id/radioGroup"
android:text="#string/static_language"
android:paddingTop="10dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<AutoCompleteTextView
android:id="#+id/aComplete_destination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/static_language"
android:layout_alignLeft="#+id/static_language"
android:ems="10"
android:inputType="textNoSuggestions"
android:text="#string/aComplete_destination" />
<TextView
android:id="#+id/static_destination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/aComplete_destination"
android:layout_alignLeft="#+id/aComplete_destination"
android:text="#string/static_destination"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<TextView
android:id="#+id/static_highways"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/static_destination"
android:layout_alignLeft="#+id/static_destination"
android:paddingBottom="10dp"
android:text="#string/static_highways"
android:textColor="#FFFFFF"
android:textSize="20sp" />
<TextView
android:id="#+id/static_tolls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/static_highways"
android:layout_alignLeft="#+id/static_highways"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="#string/static_tolls"
android:textColor="#FFFFFF"
android:textSize="20sp" />
<TextView
android:id="#+id/static_useCurrentLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/static_tolls"
android:layout_alignLeft="#+id/static_tolls"
android:paddingTop="10dp"
android:text="#string/static_useCurrentLocation"
android:textColor="#FFFFFF"
android:textSize="20sp" />
<AutoCompleteTextView
android:id="#+id/aComplete_origin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/static_useCurrentLocation"
android:layout_alignLeft="#+id/static_useCurrentLocation"
android:ems="10"
android:inputType="textNoSuggestions"
android:text="#string/aComplete_origin" >
<requestFocus />
</AutoCompleteTextView>
<TextView
android:id="#+id/static_origin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/aComplete_origin"
android:layout_alignLeft="#+id/aComplete_origin"
android:text="#string/static_origin"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<ImageView
android:id="#+id/logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/static_origin"
android:layout_alignLeft="#+id/static_origin"
android:layout_alignParentTop="true"
android:paddingBottom="10dp"
android:scaleType="fitStart"
android:src="#drawable/logo" />
<CheckBox
android:id="#+id/tolls_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/static_tolls"
android:layout_alignBottom="#+id/static_tolls"
android:layout_alignParentRight="true"
android:text="#string/checkbox" />
<CheckBox
android:id="#+id/highways_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/static_highways"
android:layout_alignBottom="#+id/static_highways"
android:layout_alignParentRight="true"
android:text="#string/checkbox" />
<CheckBox
android:id="#+id/useLocation_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/static_useCurrentLocation"
android:layout_alignBottom="#+id/static_useCurrentLocation"
android:layout_alignParentRight="true"
android:text="#string/checkbox" />
<RadioGroup
android:id="#+id/radioGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/btn_getDirections"
android:layout_alignLeft="#+id/btn_getDirections"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radio_english"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:textColor="#FFFFFF"
android:layout_marginRight="20dp"
android:text="#string/radio_english" />
<RadioButton
android:id="#+id/radio_portugues"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:text="#string/radio_portugues" />
</RadioGroup>
</RelativeLayout>
</ScrollView>
Huzzah! I got it to work! It was all a combination, of linearlayout, scrollview and relativelayout were was needed. Now it scrolls perfectly when the screen its not big enough to view the full content. I'm guessing that changing to linearlayout, was in fact the key in this. Basically i applied what was stated in developer site: http://developer.android.com/reference/android/widget/ScrollView.html
A child that is often used is a LinearLayout in a vertical
orientation, presenting a vertical array of top-level items that the
user can scroll through.
The xml:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#231E1A"
android:keepScreenOn="true"
android:scrollbars="none"
android:overScrollMode="never"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:ignore="ContentDescription"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:keepScreenOn="true"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="80dp"
android:id="#+id/logo"
android:scaleType="fitStart"
android:src="#drawable/logo"/>
<TextView
android:id="#+id/static_origin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/static_origin"
android:paddingTop="10dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF" />
<AutoCompleteTextView
android:id="#+id/aComplete_origin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textNoSuggestions"
android:text="#string/aComplete_origin" >
<requestFocus />
</AutoCompleteTextView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/static_useCurrentLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:paddingTop="10dp"
android:text="#string/static_useCurrentLocation" />
<TextView
android:id="#+id/static_tolls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/static_useCurrentLocation"
android:layout_below="#+id/static_useCurrentLocation"
android:textColor="#FFFFFF"
android:textSize="20sp"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="#string/static_tolls" />
<TextView
android:id="#+id/static_highways"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/static_tolls"
android:layout_alignLeft="#+id/static_tolls"
android:paddingBottom="10dp"
android:text="#string/static_highways"
android:textColor="#FFFFFF"
android:textSize="20sp" />
<CheckBox
android:id="#+id/tolls_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/static_tolls"
android:layout_alignBottom="#+id/static_tolls"
android:layout_alignParentRight="true"
android:text="#string/checkbox" />
<CheckBox
android:id="#+id/highways_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/static_highways"
android:layout_alignBottom="#+id/static_highways"
android:layout_alignParentRight="true"
android:text="#string/checkbox" />
<CheckBox
android:id="#+id/useLocation_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/static_useCurrentLocation"
android:layout_alignBottom="#+id/static_useCurrentLocation"
android:layout_alignParentRight="true"
android:text="#string/checkbox" />
</RelativeLayout>
<TextView
android:id="#+id/static_destination"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/static_destination"
android:textColor="#FFFFFF"
android:textAppearance="?android:attr/textAppearanceLarge" />
<AutoCompleteTextView
android:id="#+id/aComplete_destination"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textNoSuggestions"
android:text="#string/aComplete_destination" />
<TextView
android:id="#+id/static_language"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/static_language"
android:textColor="#FFFFFF"
android:textAppearance="?android:attr/textAppearanceLarge" />
<RadioGroup
android:id="#+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radio_english"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:textColor="#FFFFFF"
android:layout_marginRight="20dp"
android:text="#string/radio_english" />
<RadioButton
android:id="#+id/radio_portugues"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:text="#string/radio_portugues" />
</RadioGroup>
<Button
android:id="#+id/btn_getDirections"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/btn_getDirections" />
</LinearLayout>
</ScrollView>

ScrollView not works on Relative Layout

I am trying to make my layout Scrollable by adding ScrollView as an parent for my Relative Layout.But my layout not scrolled.I have added the fillport property to true.
Here is my xml file:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollView2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/repActivityTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:ellipsize="middle"
android:textSize="18sp"
android:background="#android:color/darker_gray"
android:text="#string/representativeTitle" />
<TextView
android:id="#+id/repStreet"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/repImage"
android:layout_marginTop="14sp"
android:layout_toRightOf="#+id/repImage"
android:layout_margin="3sp"
android:text="#string/repStreet" />
<TextView
android:id="#+id/repState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/repStreet"
android:layout_toRightOf="#+id/repImage"
android:text="#string/repState" />
<TextView
android:id="#+id/repCountry"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/repState"
android:layout_below="#+id/repState"
android:text="#string/repCountry" />
<com.google.android.maps.MapView
android:id="#+id/repMap"
android:layout_width="100dip"
android:layout_height="100dip"
android:paddingTop="2dp"
android:layout_marginTop="2dp"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/repImage"
android:apiKey="0lsQmtr2D241pSL53j0vQ2lYUs4_ZIWkIHyHAKw" >
</com.google.android.maps.MapView>
<View
android:id="#+id/firstHorizontalLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/repMap"
android:layout_marginTop="54dp"
android:background="#android:color/black" />
<TextView
android:id="#+id/issues2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/issues1"
android:layout_centerVertical="true"
android:text="#string/issues2" />
<View
android:id="#+id/secondHorizontalLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/accomplishments"
android:background="#android:color/black" />
<TextView
android:id="#+id/issues"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignBottom="#+id/firstHorizontalLine"
android:layout_alignRight="#+id/repStreet"
android:text="#string/issues" />
<TextView
android:id="#+id/accomplish2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/accomplish1"
android:layout_below="#+id/accomplish1"
android:layout_marginTop="18dp"
android:text="#string/accomplishments2" />
<TextView
android:id="#+id/promises"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/issues"
android:gravity="center"
android:layout_below="#+id/accomplish2"
android:text="#string/promises" />
<View
android:id="#+id/thirdHorizontalLine"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black"
android:layout_alignParentLeft="true"
android:layout_below="#+id/promises" />
<TextView
android:id="#+id/accomplishments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/issues2"
android:gravity="center"
android:layout_toLeftOf="#+id/repMap"
android:text="#string/accomplishments" />
<TextView
android:id="#+id/accomplish1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/secondHorizontalLine"
android:layout_marginTop="21dp"
android:text="#string/accomplishments1" />
<TextView
android:id="#+id/issues1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/issues2"
android:layout_alignParentLeft="true"
android:layout_marginBottom="14dp"
android:text="#string/issues1" />
<ImageView
android:id="#+id/repImage"
android:layout_width="100dip"
android:layout_height="100dip"
android:layout_alignParentLeft="true"
android:layout_below="#+id/repActivityTitle"
android:contentDescription="#string/representativeImage"
android:paddingTop="2dp"
android:layout_marginTop="2dp"
android:scaleType="centerCrop"
android:src="#drawable/icon" />
<TextView
android:id="#+id/promise1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/thirdHorizontalLine"
android:layout_marginTop="19dp"
android:text="#string/promises1" />
<TextView
android:id="#+id/promise2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/promise1"
android:text="#string/promises2" />
</RelativeLayout>
</ScrollView>
Here I have used the ScrollView but the full content of layout is not as showing.As scrolls not work here.
Try to remove this line and check
android:fillViewport="true"
And also you can try height of relativelayout to match_parent instead of wrap_content
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>

Categories

Resources