ScrollView内的ExpandableListView不会滚动

时间:2015-08-29 17:20:55

标签: java android expandablelistview android-scrollview android-relativelayout

所以我得到了这个非常讨厌的问题。我在ExpandableListView's内的ScrollView内有RelativeLayout,当ExpandableListView's打开(展开)时,它就像ScrollView赢了&#39}工作,我无法滚动到我的下方视图。

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>

同样在这个布局中,我在开场ScrollView - This ScrollView layout or its RelativeLayout parent is useless

上收到了警告

如果您愿意,我可以上传图片。如果有人可以提供帮助,将非常感谢。感谢。

1 个答案:

答案 0 :(得分:0)

因此,就我研究这个问题而言(我研究了很多),当View's处于打开状态时,你无法滚动ExpandableListView