我正在爲Android設備製作應用程序,並且點擊時難以保存ImageButton
的可見性。我搜索其他主題,但我還沒有找到任何解決方案。保存圖片按鈕可見性[Android]
例如,我有一個按鈕被點擊時,它變成白色了,我要保存它的知名度,當我切換活動或觀點:我想學習SharedPreferences
功能
OnClickListener oclFavourite = new OnClickListener() {
@Override
public void onClick(View arg0) {
ImageButton favWhite = (ImageButton) findViewById(R.id.favoriwhite);
ImageButton favori = (ImageButton) findViewById(R.id.favorigrey);
favWhite.setVisibility(View.VISIBLE); //The white button I want to save
favourite.setVisibility(View.INVISIBLE); //The initial button
}
};
favori.setOnClickListener(oclFavori);
,我成功的保存TextView
,但我不知道如何處理ImageButton
或ImageView
。
保存其可見性?你究竟意味着什麼,你可以詳細說明 – Goofy
,因爲你必須使用java的單例方法。 –
爲什麼你使用兩個按鈕? – Swetank