其他分享
首页 > 其他分享> > android-在包含ExpandableListView的RelativeLayout上使用ScrollView

android-在包含ExpandableListView的RelativeLayout上使用ScrollView

作者:互联网

我已经使用了这个RelativeLayout:

<?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>

问题是我希望在ScrollView或类似版本中使用它-整个布局在屏幕上不适合,尤其是当您将多个组添加到ExpandableListView时.

我尝试过将RelativeLayout放在ScrollView中,但是它根本不起作用.

如何设置带有RelativeLayout的滚动屏幕?

解决方法:

将所有视图上方的可扩展listView用作listView标头,并将下面所有视图的可作为listView页脚.然后,您对所有内容都启用了滚动.

标签:scrollview,relativelayout,expandablelistview,android
来源: https://codeday.me/bug/20191102/1988934.html