开发者社区 问答 正文

listview如何添加多个

在一个activity布局文件中如何添加多个listview控件,或是如何通过fragment实现在一个activity中添加多个listview

展开
收起
爵霸 2016-06-12 13:42:15 1919 分享 版权
1 条回答
写回答
取消 提交回答
  • 在xml文件中定义,通过ID获取。

    android:id="@+id/listView1"
     android:layout_width="match_parent"
     android:layout_height="wrap_content">
    </ListView>
         <ListView
        android:id="@+id/listView2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    
    </ListView>
    2019-07-17 19:33:48
    赞同 展开评论
问答地址: