我的按钮使用代码,用于显示和隐藏视图显示观点:如果显示,则以编程方式隐藏视图。如果它隐藏
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 –