Set system UI to low profile
Description
The following code shows how to Set system UI to low profile.
Example
Main layout xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Toggle Mode"
android:onClick="onToggleClick" />
</RelativeLayout>
Main Activity Java code
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
/*w w w. j av a2s .c om*/
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onToggleClick(View v) {
int currentVis = v.getSystemUiVisibility();
int newVis;
if ((currentVis & View.SYSTEM_UI_FLAG_LOW_PROFILE) == View.SYSTEM_UI_FLAG_LOW_PROFILE) {
newVis = View.SYSTEM_UI_FLAG_VISIBLE;
} else {
newVis = View.SYSTEM_UI_FLAG_LOW_PROFILE;
}
v.setSystemUiVisibility(newVis);
}
}