将静态数据添加到使用ListAdapter的动态创建的ListView中

|| 我想将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,但对于异构数据源而言,却非常方便。您可以按任意顺序很好地将多个适配器和视图缝合在一起。     

要回复问题请先登录注册