我的按鈕使用代碼,用於顯示和隱藏視圖顯示觀點:如果顯示,則以編程方式隱藏視圖。如果它隱藏
public void onClick (View v){
if (What code you need to enter here to determine hidden views or shown)
{
testActivity.setVisibility(View.VISIBLE);
}
else
{
testActivity.setVisibility(View.GONE);
}
}
我需要什麼樣的代碼在「如果()」,這樣點擊我的按鈕被選中條件添加。如果活動被隱藏,則應該顯示,反之亦然。如果顯示視圖,請隱藏它。
見http://steveliles.github.io/is_my_android_app_currently_foreground_or_background .html –