如何使用模拟时钟切换状态栏的视图(点击显示 - 重新点击隐藏)?
我目前正在使用此代码:
public void Display(View view){
if(visibility !=0){
AnalogClock analogclock=(AnalogClock)findViewById(R.id.analogClock1);
analogclock.setOnClickListener(new AnalogClock.OnClickListener(){
@Override
public void onClick(View view) {
// TODO Auto-generated method stub
AnalogClock analogclock=(AnalogClock)findViewById(R.id.analogClock1);
analogclock.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
getActionBar().show();
visibility=0;
}
});
}
else{
AnalogClock analogclock=(AnalogClock)findViewById(R.id.analogClock1);
analogclock.setOnClickListener(new AnalogClock.OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
AnalogClock analogclock=(AnalogClock)findViewById(R.id.analogClock1);
analogclock.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
getActionBar().hide();
visibility++;
}
它会隐藏状态栏,但在再次单击模拟时钟时不会显示状态栏。