gpt4 book ai didi

Android 微调监听器

转载 作者:太空狗 更新时间:2023-10-29 16:21:47 27 4
gpt4 key购买 nike

我在向微调器添加监听器时遇到问题。当我点击某个微调器的项目时,什么也没有发生。这是我的代码:

    Button button_marker= (Button) findViewById(R.id.button_markers);
ArrayAdapter<CharSequence> adapter=ArrayAdapter.createFromResource(this, R.array.markers, android.R.layout.simple_spinner_item);
spinner= new Spinner(this);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);

button_marker.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
spinner.performClick();
}
});

new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Log.e("klkl", "klkl");

}

public void onNothingSelected(AdapterView<?> arg0) {
Log.e("klkl", "klkl");


}
});

最佳答案

spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Log.e("klkl", "klkl");

}

public void onNothingSelected(AdapterView<?> arg0) {
Log.e("klkl", "klkl");

}
});

关于Android 微调监听器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12644444/

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