Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- ๋ ์
- ์ค๋ผํด
- html
- ComputerScience
- ๋ฐ์ํ
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- ์ฝ๋ฉ
- ๋ผํ๋ผ์ค์๋ง๋
- Java
- ์๋ฐ์คํฌ๋ฆฝํธ
- ์ค๋ธ์
- ์๋ฐ
- ๋ง์ผ๋ด๊ฐ์ธ์์๋ค์์ฐ๋ค๋ฉด
- ์นํ์ด์ง๋ง๋ค๊ธฐ
- ๊ฐ๋ฐ
- ์ปดํจํฐ๊ณผํ
- ์ฑ
- ํ์ด์ฌ
- K๋ฐฐํฐ๋ฆฌ
- ํ๋ก๊ทธ๋๋ฐ
- ๊น๋ฏธ๊ฒฝ์๋งํ์์
- ์นํผ๋ธ๋ฆฌ์ฑ
- database
- ํฐ์คํ ๋ฆฌ์ฑ๋ฆฐ์ง
- ๋ฆฌ์กํธ
- JavaScript
- K๋ฐฐํฐ๋ฆฌ๋ ๋ณผ๋ฃจ์
- css
- Python
- ์ํ
Archives
- Today
- Total
JiYoung Dev ๐ฅ
[Android] listView ๋ง๋ค๊ธฐ (2023.07.14) ๋ณธ๋ฌธ
package com.sjy.ex20230712
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.ListView
class SubActivity : AppCompatActivity() {
lateinit var btn_moveMain : Button
lateinit var listview : ListView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_sub)
btn_moveMain = findViewById(R.id.btn_moveMain)
listview = findViewById(R.id.listview)
btn_moveMain.setOnClickListener {
// var it_moveMain : Intent = Intent(this, MainActivity::class.java)
// startActivity(it_moveMain) //์๋ก์ด Activity๋ฅผ Task์ ์๋ ๋ช
๋ น
finish() //Activity ์ญ์
}
//listview ๋ง๋ค๊ธฐ
//1. ๋ฐ์ดํฐ (๋์ฐ๊ณ ์ ํ๋ ๋ฐ์ดํฐ)
//2. ํ
ํ๋ฆฟ (ํ ์ค์ ์ด๋ค ๋ชจ์์ผ๋ก ํ์ํ ๊ฒ์ธ์ง) - ํ
ํ๋ฆฟ ๋์์ธ : Custom list view
// => android์์ ์ ๊ณตํ๋ ํ
ํ๋ฆฟ ์ฌ์ฉ
//3. Adapter (Data + ํ
ํ๋ฆฟ)
// => android์์ ์ ๊ณตํ๋ adaptor ์ฌ์ฉ
//1. ๋ฐ์ดํฐ
var foods = arrayOf("ํ๋ฒ๊ฑฐ", "ํผ์", "์นํจ", "๋ผํด์ฅ๊ตญ", "๋ญ๋ฐ")
//2. ์ด๋ํฐ ์์ฑ
// android ์ ๊ณต ๊ธฐ๋ณธ ํ
ํ๋ฆฟ ๋ฐ์ดํฐ
var adapter = ArrayAdapter<String>(applicationContext, android.R.layout.simple_list_item_1, foods )
//3. listview์ adaptor ์ฐ๊ฒฐ
listview.adapter = adapter
}
}
'full stack > ์๋๋ก์ด๋' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Android] intent & listView ์ฌํ (2023.07.18) (0) | 2023.07.18 |
---|---|
[Android] HTTP ํต์ - Volley (2023.07.18) (0) | 2023.07.18 |
[Android] intent (2023.07.14) (0) | 2023.07.14 |
[Android] ์๋ฃ๊ตฌ์กฐ (2023.07.14) (0) | 2023.07.14 |
[Android] ๋ฌต์์ Intent (2023.07.13) (0) | 2023.07.13 |