當前位置:首頁 » 安卓系統 » android按鈕不可用

android按鈕不可用

發布時間: 2024-10-23 19:42:33

1. android開發中button按鈕不起作用,btn不響應點擊事件,檢查沒有發現代碼的問題。

你既然已經 findViewById了你的button了,你又去實例化一個btn,那這樣你的btn其實是你new的那個,但是你在你的Activity上看到的是你findViewById的那個Button,你new的btn由於你沒設置他的位置,所以你看不到!

2. android中獲取Button按鈕為什麼會出錯

你這個Button的包都沒導進去啊攜手姿,還有Intent的也沒有薯祥導入,用ctrl+shift+o讓辯絕它自己導入就好了!

3. android,圖片按鈕不能點擊啊,點擊後圖片按鈕都沒有動,什麼原因啊

布局文件設置圖片按鈕,如果沒有監聽點擊事件,是沒有反應的,可以使用:
newsback.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View v) {
finish();
}
});

4. android添加按鈕出錯,Button bn = new Button(this);報錯

把this換成MainActivity.this,因為你是在匿名內部類使用this,你的this是指OnClickListener

5. android 怎麼讓按鈕不可點擊

Button.setEnabled(false); 按鈕的「setEnabled」方法設為false就可以了。

熱點內容
vs2010怎麼寫c語言 發布:2025-09-19 07:31:05 瀏覽:869
除了證券外還有哪些投資配置 發布:2025-09-19 07:01:48 瀏覽:77
android把函數 發布:2025-09-19 07:01:04 瀏覽:283
垃圾站源碼 發布:2025-09-19 06:42:30 瀏覽:156
java按鈕事件 發布:2025-09-19 06:29:45 瀏覽:457
文件夾用處 發布:2025-09-19 06:21:42 瀏覽:88
php數組位置 發布:2025-09-19 06:06:45 瀏覽:865
伺服器光口配ip 發布:2025-09-19 05:48:37 瀏覽:848
phpmongodb擴展 發布:2025-09-19 05:35:23 瀏覽:778
停資料庫監聽 發布:2025-09-19 05:35:14 瀏覽:47