Reputation: 550
What i want to reach is, that the user can't go out of the activity except when he presses one of the supplied buttons.
I've already caught the home and back button, but when i try to remove the status bar, my problems begin.
I would like to have one of the following:
If I go for solution 1, this isn't possible if my application is running and Activity1 is showing the status bar, then Activity2 is shown under the status bar, the status bar overlays the top of Activity2
Except when I start Activity2 from another application, then Activity2 isn't showing the status bar.
What am I doing wrong?
Part of AndroidManifest.xml:
<activity
android:label="@string/app_name"
android:launchMode="standard"
android:name=".Activity1"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
android:label="@string/app_name"
android:launchMode="standard"
android:name=".Activity2"
android:noHistory="true"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter >
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.MONKEY" />
</intent-filter>
</activity>
Upvotes: 3
Views: 5518
Reputation: 71
To check status bar visibility try this code:
public boolean isStatusBarVisible() {
Rect rectangle = new Rect();
Window window = getActivity().getWindow();
window.getDecorView().getWindowVisibleDisplayFrame(rectangle);
int statusBarHeight = rectangle.top;
return statusBarHeight != 0;
}
Upvotes: 4
Reputation: 550
I had to start my activity in android:launchMode="singleInstance" and in OnAttachedToWindow() i had to call this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD); Now the status bar won't be shown even if other Activities in the same application do show the status bar.
Upvotes: 1
Reputation: 165
I think this guide can be helpful for theming
http://brainflush.wordpress.com/2009/03/15/understanding-android-themes-and-styles/
Upvotes: 2