android:orientation
Set vertical / horizontal view inside layout
Listview
1. We should make list type to save data
List<String> data = new ArrayList<>();
2. Make Arrayadapter to connect array to listview
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.listtype, data)
'This' means this activity, android.R.layout.listtype sets list type, data is a Array list.
3. Set adapter to list
list.setAdapter(adapter)
'list' should be the name of listview variable.
4. Add data
data.add("value");
5. Save change
adapter.notifyDataSetChanged();
출처 : https://www.youtube.com/playlist?list=PLC51MBz7PMyyyR2l4gGBMFMMUfYmBkZxm
'Android' 카테고리의 다른 글
| Webview (0) | 2022.02.02 |
|---|---|
| SharedPreferences (0) | 2022.01.31 |
| Package (0) | 2022.01.30 |
| Intent (0) | 2022.01.29 |
| EditText&Button (0) | 2022.01.29 |