In my application i am working with canvas. I am drawing on canvas. I put canvas color as white. When my app open the canvas is visible along with above status bar. But i want my canvas should take the full screen. means that Notification status bar should disapear when i run that app bt not the title bar(bcz i m using some custom title bar) How can i do that?
By using below code i gave custom title,
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
Now i am trying to hide status bar using below code in activity-
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
and in AndroidManifest.xml
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
But it shows force close. Give me a way how to do that?
You can't use
Window.FEATURE_CUSTOM_TITLE
after settingTheme.NoTitleBar
. It's enough to use just this theme. Do not set all these flags in code.EDIT: Seems I misunderstood your question. I read it again carefully and now I see you're asking about Android 2.x and its notification bar. Your
onCreate()
method should look like this:You mustn't set
Theme.NoTitleBar
orTheme.NoTitleBar.Fullscreen
for this activity. Just use the defaultTheme
or don't specify any theme at all.Am going to tell you how to tackle the title bar and the system notification panel individually and perfectly. Use one or both as per Your Need.
1.Do not apply any theme to the Activity through XML.
2.Now, go the corr. Java file and add these lines inside onCreate().. after super.onCreate()..
Part.a. to remove just Title Bar
Part.b. to remove the System notification panel
Do not forget to follow them with the usual
It's enough to remove the line
But if you want to display full screen (without action bar) write too