简体   繁体   中英

ExpandableListView's inside a ScrollView won't scroll

So i got this really annoying issue. I have got ExpandableListView's inside a ScrollView inside a RelativeLayout and when the ExpandableListView's are open(Expand) it's like the ScrollView won't work and i can't scroll to get to my lower View's.

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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:focusable="true"
android:focusableInTouchMode="true" 
tools:context="com.example.activity.Activity" >

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >
<TextView
    android:id="@+id/emai_to_send_to_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/emai_to_send_to_text_view_text"
    android:textSize="16sp"
    android:textStyle="bold"
    android:textColor="@color/opening_words_list_view_header_color"
    />

<EditText
    android:id="@+id/emai_to_send_to_edit_text_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="@string/emai_to_send_to_edit_text_hint"
    android:inputType="text"
    android:textSize="18sp"
    android:textColor="@color/selection_text_color"
    android:layout_below="@id/emai_to_send_to_id"
    />

<ExpandableListView
    android:id="@+id/opening_expandable_list_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/emai_to_send_to_edit_text_id"
    />

<TextView
    android:id="@+id/opening_words_text_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/initial_text"
    android:textSize="18sp"
    android:layout_below="@id/opening_expandable_list_view_id"
    android:textColor="@color/selection_text_color"
    />

<TextView
    android:id="@+id/name_header_text_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/name_text"
    android:textSize="16sp"
    android:textStyle="bold"
    android:textColor="@color/opening_words_list_view_header_color"
    android:layout_below="@id/opening_words_text_view_id"
    />

<EditText
    android:id="@+id/name_edit_text_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="@string/name_edit_text_hint"
    android:inputType="text"
    android:textSize="18sp"
    android:textColor="@color/selection_text_color"
    android:layout_below="@id/name_header_text_view_id"
    />

<ExpandableListView
    android:id="@+id/something_i_hate_about_you_expandable_list_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/name_edit_text_id"
    />

<TextView
    android:id="@+id/something_i_hate_about_you_text_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/initial_text"
    android:textSize="18sp"
    android:layout_below="@id/something_i_hate_about_you_expandable_list_view_id"
    android:textColor="@color/selection_text_color"
    />

 <ExpandableListView
    android:id="@+id/hope_you_will_expandable_list_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/something_i_hate_about_you_text_view_id"
    />

<TextView
    android:id="@+id/hope_you_will_text_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/initial_text"
    android:textSize="18sp"
    android:layout_below="@id/hope_you_will_expandable_list_view_id"
    android:textColor="@color/selection_text_color"
    />

<ExpandableListView
    android:id="@+id/ps_expandable_list_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/hope_you_will_text_view_id"
    />

<TextView
    android:id="@+id/ps_text_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/initial_text"
    android:textSize="18sp"
    android:layout_below="@id/ps_expandable_list_view_id"
    android:textColor="@color/selection_text_color"
    />

<TextView
    android:id="@+id/your_name_header_text_view_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/your_name_text"
    android:textSize="16sp"
    android:textStyle="bold"
    android:textColor="@color/opening_words_list_view_header_color"
    android:layout_below="@id/ps_text_view_id"
    />

<EditText
    android:id="@+id/your_name_edit_text_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:hint="@string/your_name_edit_text_hint"
    android:inputType="text"
    android:textSize="18sp"
    android:textColor="@color/selection_text_color"
    android:layout_below="@id/your_name_header_text_view_id"
    />

<Button 
    android:id="@+id/send_email_button_id"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/send_email_button_text"
    android:layout_below="@id/your_name_edit_text_id"
    />
</RelativeLayout>
</ScrollView>
</RelativeLayout>

Also in this layout i got a warning on the opening ScrollView - This ScrollView layout or its RelativeLayout parent is useless

I can upload pictures if youd like. Please if anyone can help it will be very appreciated. Thanks.

因此,据我研究的问题(并且研究了很多),在ExpandableListView处于打开状态时,无法滚动View's

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM