Can I hide the Android top status bar (time & charging icon appears)? Actually there is some difference in the positing of elements when i run things on device and on emulator. I want to run my code and many different emulators for testing purpose, any help?
3 Answers
To completely remove system bar from Android Emulator(tested with Android 4.0.3):
- Navigate to %USER_HOME%\.android\avd\avd_name.avd\
Edit config.ini :
hw.mainKeys=no - turn system bar OFF
hw.mainKeys=yes - turn system bar ON
1 Comment
Hai Zhang
Thank you, this is the right answer. Config files are way more reliable than UI :P
Dynamically in Java
this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); OR
Declare in menifest.xml like..
Add the following in application if you want to remove it for all the activities in an app: <application android:theme="@android:style/Theme.Black.NoTitleBar"> Or for a particular activity: <activity android:theme="@android:style/Theme.Black.NoTitleBar"> EDIT:-
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" And write following in oncreate() method.
@Override public void onCreate(android.os.Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main); } 1 Comment
jay
I am asking about the system bar and i have edited the question, on which charging icon and time appears.
try something like this :
<activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar.Fullscreen"> </activity> Or do something like this before your setContentView() in onCreate
requestWindowFeature(Window.FEATURE_NO_TITLE) 1 Comment
jay
I am asking about the system bar and i have edited the question, on which charging icon and time appears.