3

I've got this RelativeLayout I am using:

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <Button
            android:layout_width="wrap_content"
            android:id="@+id/screen_team_enableproximity"
            android:text="Enable proximity"
            android:layout_height="wrap_content"
            android:layout_alignBaseline="@+id/screen_team_checkboxproximity"
            android:layout_alignBottom="@+id/screen_team_checkboxproximity"
            android:layout_alignParentLeft="true"
            android:layout_toLeftOf="@+id/screen_team_checkboxproximity"></Button>
        <CheckBox
            android:layout_width="wrap_content"
            android:id="@+id/screen_team_checkboxproximity"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:clickable="false"></CheckBox>
        <ExpandableListView
            android:layout_width="match_parent"
            android:id="@+id/screen_team_teamslist"
            android:layout_height="match_parent"
            android:layout_below="@+id/screen_team_availableteams"
            android:layout_centerHorizontal="true"></ExpandableListView>
        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/screen_team_availableteams"
            android:text="Available Teams"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:layout_below="@+id/screen_team_getallteams"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="10dp"></TextView>
        <Button
            android:text="Create Team"
            android:id="@+id/screen_team_createteam"
            android:layout_height="wrap_content"
            android:layout_below="@+id/screen_team_enableproximity"
            android:layout_width="match_parent"
            android:layout_marginTop="65dip"></Button>
        <Button
            android:text="Delete Team"
            android:id="@+id/screen_team_deleteteam"
            android:layout_height="wrap_content"
            android:layout_below="@+id/screen_team_createteam"
            android:layout_centerHorizontal="true"
            android:layout_width="match_parent"></Button>
        <Button
            android:layout_width="match_parent"
            android:text="Get available teams"
            android:id="@+id/screen_team_getallteams"
            android:layout_height="wrap_content"
            android:layout_below="@+id/screen_team_deleteteam"
            android:layout_alignParentLeft="true"></Button>
    </RelativeLayout>

The problem is I want to it to be used inside a ScrollView or similiar - the entire layout does not fit on the screen, especially when you add several groups to the ExpandableListView.

I've tried putting the RelativeLayout inside a ScrollView, but it dosn't work at all.

How do I setup a scrolling screen with my RelativeLayout in it?

Adinia
  • 3,722
  • 5
  • 40
  • 58
KaiserJohaan
  • 9,028
  • 20
  • 112
  • 199

3 Answers3

4

Put all the views above the expandable listView as listView header , and all the views below as listView footer. Then you have scrolling enabled for everything.

Yashwanth Kumar
  • 28,931
  • 15
  • 65
  • 69
0

This is a tricky one. There were several discussion here on SO on how to use ScrollView with ListView. Have a look at this question: Scrolling with Multiple ListViews for Android. The idea is to have only one list (create a custom adapter) and add headers and footers before and after your Expandable list.

Community
  • 1
  • 1
Maggie
  • 7,823
  • 7
  • 45
  • 66
0

Apart from header/footer approach if you will define all the view before expandableList and give it relative position (layout_above/layout_below) , u will get the desired view .

Shailendra Singh Rajawat
  • 8,172
  • 3
  • 35
  • 40