2016-01-15 63 views
0
ImageButton plusButton = new ImageButton(context); 
    plusButton.setImageResource(x); 

我需要一些資源來代替上述代碼行中的「字段在下面的圖像.- enter image description here如何在android中獲取減號和加號按鈕

但我不知道這些圖像的資源在哪裏。所以請幫我解決這個問題。謝謝。

+0

使用此帖子的答案: [https://stackoverflow.com/questions/28684759/import-material-design-icons-into-an-android-project](https://stackoverflow.com/questions/28684759/import-material-design-icons-into-an-android-project) – digitaldaemon

回答

0

試試這個:Menu或者如果你想ID:

getResources().getDrawable(android.R.drawable.*); 

,並在數據/ RES /繪製搜索。

+0

我的意思是,你知道確切的資源'android.R.drawable。*'來獲得圖像中顯示的負號。我沒有找到資源。 P.S我發現加號按鈕的資源是'android.R.drawable.ic_input_add' –

+0

您是否搜索數據文件夾? – garima

+0

我輸入了android.R.drawable,然後在android studio的自動完成建議中搜索。沒有任何東西符合圖像中顯示的減號。我發現了很大的紅十字按鈕,但我覺得它會使佈局笨拙,所以我決定只用加號按鈕去掉減號按鈕。也許,減號按鈕是定製的,誰知道? –

1

負號的圖標在材質設計圖標集中稱爲「移除」。

相關問題