我用的是这个
<?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>
问题是我希望它在
RelativeLayout
或类似的程序中使用-整个布局不适合屏幕,特别是当您向ScrollView
添加多个组时。我试过把
ExpandableListView
放在RelativeLayout
里面,但根本不起作用。如何设置包含
ScrollView
的滚动屏幕? 最佳答案
将可展开列表视图上方的所有视图作为列表视图页眉,将下方的所有视图作为列表视图页脚。然后你就可以滚动所有的东西了。