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 | 31 |
Tags
- MSSQL
- NPM
- hadoop
- Spring
- JavaScript
- table
- Express
- Android
- GIT
- Python
- xPlatform
- IntelliJ
- 정렬
- Kotlin
- tomcat
- R
- window
- 공정능력
- maVen
- SPC
- mapreduce
- react
- vaadin
- SQL
- Eclipse
- Sqoop
- 보조정렬
- es6
- Java
- mybatis
Archives
- Today
- Total
DBILITY
독거 가능성 100% 노후에 라면값이라도 하게 센스를 발휘합시다!😅
Please click on the ad so that I can pay for ramen in my old age!
点击一下广告,让老后吃个泡面钱吧!
老後にラーメン代だけでもするように広告を一回クリックしてください。
안드로이드 spinner(combo) 사용법 본문
반응형
class MainActivity : AppCompatActivity() {
private val binding by lazy {
ActivityMainBinding.inflate(layoutInflater)
}
private var list = listOf("--선택하세요--","사과","바나나","귤")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//enableEdgeToEdge()
setContentView(binding.root)
/*ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
insets
}*/
var spinnerAdapter = ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,list)
with(binding) {
spinner.apply {
adapter = spinnerAdapter
onItemSelectedListener = object : OnItemSelectedListener {
override fun onItemSelected(
parent: AdapterView<*>?,
view: View?,
position: Int,
id: Long
) {
var selectedItem = list[position]
tvSpinnerSelect.text = selectedItem
}
override fun onNothingSelected(parent: AdapterView<*>?) {
Log.d("onNothingSelected","이건 언제 동작하는겨?")
}
}
}
}
}
}
반응형
'android' 카테고리의 다른 글
안드로이드 RecyclerView 기초 사용법 (0) | 2024.03.05 |
---|---|
안드로이드 enableEdgeToEdge,setOnApplyWindowInsetsListener (0) | 2024.03.05 |
안드로이드 RatingBar 사용법 (0) | 2024.02.28 |
안드로이드 seekbar 사용법 (0) | 2024.02.28 |
안드로이드 checkbox,toggle,switch 간단 사용법 (0) | 2024.02.28 |
Comments