Android:可扩展列表未在屏幕上完全展开

时间:2014-04-16 09:30:45

标签: android listview

This is my App screen on the top there is an expandable listview, and underneath there are buttons having images,

这是我的应用程序屏幕顶部有一个可扩展的列表视图,下面有按钮有图像,

now the problem is the expandable listview expands on specific area not expand itself to show all items as displayed in snap,

现在问题是可扩展列表视图扩展特定区域不扩展自身以显示快照中显示的所有项目

我需要的是,当用户点击父项时,它会在所有按钮的前面展开子项,以便按钮隐藏在列表视图后面,或者当用户滚动按钮时,按钮会在列表视图后面... 就像在每件事物的正面显示的admob广告一样,也是

的快照

i want to show listview like this, as admob banner 我想像这样展示listview,作为admob banner

这是我的xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame"
android:background="@drawable/background2">


<ScrollView
    android:layout_height="match_parent"
    android:layout_width="fill_parent"
    android:fillViewport="true"
    android:id="@+id/scrollView"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true">


<LinearLayout
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:orientation="vertical"
    android:focusable="false"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true">


    <ExpandableListView
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >
    </ExpandableListView>







    <Button

        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:id="@+id/button31"
        android:layout_marginTop="8dp"
        android:background="@drawable/anaheim"

        android:width="@dimen/abc_search_view_preferred_width"
        android:height="@dimen/abc_action_button_min_width" />


    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/button"
        android:layout_marginTop="8dp"
        android:background="@drawable/boston"
        android:layout_alignParentTop="true"
        android:layout_alignRight="@+id/scrollView"
        android:width="@dimen/abc_search_view_preferred_width"
        android:height="@dimen/abc_action_button_min_width" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/button11"
        android:layout_marginTop="8dp"
        android:layout_alignTop="@+id/button"
        android:layout_alignParentRight="true"
        android:background="@drawable/buffalo"
        android:width="@dimen/abc_search_view_preferred_width"
        android:height="@dimen/abc_action_button_min_width"/>
 </LinearLayout>

</ScrollView>

</RelativeLayout>

提前致谢

1 个答案:

答案 0 :(得分:0)

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="fill_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:ignore="MergeRootFrame"
android:background="@drawable/background2">


<ScrollView
android:layout_height="match_parent"
android:layout_width="fill_parent"
android:fillViewport="true"
android:id="@+id/scrollView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">


<LinearLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical"
android:focusable="false"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true">


<Button

    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:id="@+id/button31"
    android:layout_marginTop="8dp"
    android:background="@drawable/anaheim"

    android:width="@dimen/abc_search_view_preferred_width"
    android:height="@dimen/abc_action_button_min_width" />


<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/button"
    android:layout_marginTop="8dp"
    android:background="@drawable/boston"
    android:layout_alignParentTop="true"
    android:layout_alignRight="@+id/scrollView"
    android:width="@dimen/abc_search_view_preferred_width"
    android:height="@dimen/abc_action_button_min_width" />

<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/button11"
    android:layout_marginTop="8dp"
    android:layout_alignTop="@+id/button"
    android:layout_alignParentRight="true"
    android:background="@drawable/buffalo"
    android:width="@dimen/abc_search_view_preferred_width"
    android:height="@dimen/abc_action_button_min_width"/>
 </LinearLayout>

</ScrollView>
<ExpandableListView
    android:id="@+id/listView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    >
</ExpandableListView>
</RelativeLayout>

感谢@selvin