我想将X数量的静态行添加到使用ListAdapter / BaseAdapter的ListView当前动态填充的ListView中。有什么建议么?

提前谢谢,科尔。

我的解决方案:根据@Femi的建议,我最终使用了MergeAdapter。这是我所做的摘要:

    // create a new MergeAdapter
    MergeAdapter aMergeAdapter = new MergeAdapter();

    // add the dynamic content
    SkipToListActivityValueAdapter skipToListActivityValueAdapter =
        new SkipToListActivityValueAdapter(this, sections);
    aMergeAdapter.addAdapter(skipToListActivityValueAdapter);

    // add the static content
    ArrayAdapter<String> aArrayAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, ADDITIONAL_SKIP_TO_OPTIONS);
    aMergeAdapter.addAdapter(aArrayAdapter);

    // add the aMergeAdapter to the ListAdapter
    setListAdapter(aMergeAdapter);

最佳答案

答案是@commonsware的MergeAdapter。有关详细信息,请参见https://github.com/commonsguy/cwac-merge,但是对于异类数据源来说,它却非常方便。您可以按任意顺序很好地将多个适配器和视图缝合在一起。

10-06 03:01