相关文章推荐
跑龙套的台灯  ·  RecyclerView#smoothScr ...·  1 周前    · 
机灵的香槟  ·  Android RecyclerView ...·  1 周前    · 
行走的消防车  ·  RV 的 scrollToPosition ...·  1 周前    · 
纯真的杯子  ·  RecycleView嵌套子RecycleV ...·  1 周前    · 
打篮球的火车  ·  linux shell ...·  2 年前    · 
礼貌的皮带  ·  Swift ...·  2 年前    · 
憨厚的鼠标  ·  Hadoop Streaming ...·  2 年前    · 

示例代码:

List<String> items = new ArrayList<>();
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items);
ListView listView = findViewById(R.id.listView);
listView.setAdapter(adapter);
// Add items to the data source
items.add("Item 1");
items.add("Item 2");
// Notify the adapter that the data has changed
adapter.notifyDataSetChanged();
              ifubing
          
5年前