Android
  • 官方文件
  • Android studio
    • Layout Editor
    • WebView
    • 發佈
    • 常見問題
  • 專案架構
    • AndroidManifest.xml
  • 程式相關
    • Material Design
    • 隱藏 title bar
    • HTTP GET
    • 使用 Java 8
    • onClick
    • 新增畫面
    • delay
    • Layout 檔案設定
    • WebRTC
  • listView
Powered by GitBook
On this page

Was this helpful?

listView

PreviousWebRTC

Last updated 4 years ago

Was this helpful?

先在 xml 建立

    <ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/listView1"
        />

然後使用 adapter

ListView listView = findViewById(R.id.listView1);
ArrayAdapter listAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, new String[]{"一", "二", "三"});
listView.setAdapter(listAdapter);

android.R.layout.simple_list_item_1 為原生提供

https://qiita.com/vc7/items/3fe9edded4b8306646f5