gpt4 book ai didi

android - kotlin中onItemClickListener的实现

转载 作者:行者123 更新时间:2023-12-02 12:31:29 25 4
gpt4 key购买 nike

如何实现 onItemClickListener()定制listView在 Kotlin ?_

title_list_view.setOnItemClickListener{ adapterView: AdapterView<*>?, 
view: View?, position: Int, l: Long ->
}

单击自定义项后如何开始新 Activity ListView ?

最佳答案

尝试这个

    title_list_view.setOnItemClickListener { parent, view, position, id ->   

Toast.makeText(this, "Clicked item :"+" "+position,Toast.LENGTH_SHORT).show()
Intent intent = new Intent(CurrentActivity.this, NextActivity.class);
intent.putExtra("position", position);
this.startActivity(intent);
}

关于android - kotlin中onItemClickListener的实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49336317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com