GridView项目不在可扩展列表内滚动

时间:2016-05-23 13:54:51

标签: android gridview xamarin xamarin.android expandablelistview

我有一个可扩展的列表,第一个孩子是Gridview。这里我有gridview高度切割的问题。我通过使用这个解决方案解决了:Gridview height gets cut

现在我遇到的新问题是,无法在某个固定高度下滚动gridview项目。我需要在这里添加滚动条,因为gridview项可能会动态增长。

我可以使用普通的gridview执行此操作,但在可扩展列表视图下显示这个烦人的问题。

代码:

sub_query = ProductSale.select("product_location_id, MAX(net_sale) as max_net_sale").where("sale_date BETWEEN '2016-05-01' AND '2016-05-31'").group("product_location_id").to_sql
ProductSale
       .joins("INNER JOIN (#{sub_query}) t ON product_sales.product_location_id = t.product_location_id AND product_sales.net_sale = t.max_net_sale")

可扩展列表自定义布局中的Gridview:

 <ExpandableListView
            android:id="@+id/Explst"
            android:layout_height="400dp"
            android:transcriptMode="disabled"
            android:layout_width="match_parent"
            android:layout_marginTop="0.5dp" />

自定义expandableheightgridview.cs

  <mynamespace.ExpandableHeightGridView
        android:id="@+id/gridview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:columnWidth="90dp"
        android:numColumns="auto_fit"
        android:verticalSpacing="20dp"
        android:horizontalSpacing="2dp"
        android:stretchMode="columnWidth"
        android:isScrollContainer="false"
        android:gravity="center" />

任何建议/提示/链接都很明显。 我在xamarin.android c#中尝试过这个,但即使是任何java android解决方案也很有帮助。

由于

1 个答案:

答案 0 :(得分:0)

您必须设置expand = true;

mExpandGrid= (ExpandableHeightGridView) findViewById(R.id.mExpandGrid);
mExpandGrid.setExpanded(true);
相关问题