I've applied this style as below
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowActionBar">false</item>
<item name="windowActionBar">false</item>
<item name="android:windowTitleSize">0dp</item>
...
when i run the application at the first time the title bar is not showing but when i want to write in editbox (when editbox focus) part of the title bar appears
note I've tried to use full screen style and it was working perfectly BUT i want the action bar to be there
Check Images below
Before
http://i.stack.imgur.com/l9Wrf.png
After
http://i.stack.imgur.com/VeOHH.png
Might solve your problem, use this code in onCreate() method and check :
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Add this line
setContentView(R.layout.YouActivityName);
.
.
//whatever code you have here
}
it was really hard to solve it after trying all possible suggested solutions,
eventually the solution is to do the following
modify my minifist to with the following code
android:name=".activity.Main"
android:windowSoftInputMode="stateVisible|adjustPan"
Related
I wanted to make a perfectly blended splash screen WITHOUT it being Fullscreen. By that I mean I want to make a splash screen which its background color blends with the status bar. I was successful in achieving making a splash screen the right way (by that I mean by editing the android xml files) and making the status bar color the same as the splash screen's background color but there is this some kind of overlay grey-ish color thingy that shows over the status bar for some fraction of seconds. I can't even capture it in a screen shot. I have tried different methods. The SystemOverlay call with statusBarColor set to transparent, didn't work, it only changes the app theme's status bar color that renders after the splash screen. I have tried different parent attributes for my splash theme (like Theme.Holo.NoTitleBar and all other bunch), but still the problem persists. And then i tried to play with style item in styles.xml. Here are the bunch of items I have tried (Not all at once though).
<item name="android:windowBackground">#drawable/launch_background</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowActionBarOverlay">false</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:background">#android:color/transparent</item>
<item name="android:windowDisablePreview">true</item>
<item name="android:windowIsTranslucent">true</item>
Answer this question if you have successfully removed the overlay thing. Please don't give me hope with just a guess or something you haven't tried for yourself. And BELEIVE ME, I have been searching up and down for this and I have only found one person with this question in his/her main question's comment section but this person couldn't get an answer so that is why I posted it as a question. Maybe i have missed it, so if this question is answered elsewhere, please provide me with the link. Thank you in advance!
Have you tried making the statusbarcolor transparant?
In styles.xml:
<item name="android:navigationBarColor">#android:color/transparent</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
And in MainActivity.kt:
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
}
It work for me.
I want to hide the top bar from splash screens 1:[First image] 2:[Second Image] as you can see these are two splash screens sample and i want to hide the upper bar which shows battery status and other things on image2,which is also shown in my app
Add this line of code in your Manifest file under the Splashscreen activity.
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
When u use AppCompat you have to include below line of code in your style to get the FullScreen.
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="#style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
I'm writing an app which will be on embedded device, and I need to remove ActionBar alongside the TitleBar and ContentOverlay.
I found a solution and inserted the following in my styles:
<style name="NoActionBar" parent="#android:style/Theme.Holo.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
</style>
and also add the line to my activity in AndroidManifest:
android:theme="#style/NoActionBar"
and in the end I got no title bar, no content overlay, however the ActionBar is still there. Please advice. I use android:theme="#android:style/Theme.Holo.Light" and my targetSdkVersion is 18.
Small mistakes in XML can cause very strange problems,
which are not always reported accurately by the build process.
I tend to shy away from changing XML, when I can do it in java.
Java gives you more control.
programmatically remove action bar
----------------------------------
from normal activity
getActionbar().hide();
getActionbar().show();
if your using support activity
getSupportActionBar().hide();
getSupportActionBar().show();
and from the Fragment you can do it
getActivity().getActionbar().hide();
getActivity().getActionbar().show();
remove title bar
----------------
public class ActivityName extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// remove title
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
}
}
ActionBar ContentOverlay
------------------------
1) Request for actionbar overlay programmatically by calling
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
// this 'requestFeature()' must be requested from your activity 'onCreate()' method
// before calling for 'setContentView(R.layout.my_layout)':
2) set the actionbar color by calling setBackgroundDrawable() like so:
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00212121")) );
Try changing your style's parent like this :
parent="#android:style/Theme.Holo.Light.NoActionBar"
Example
<style name="NoActionBar" parent="#android:style/Theme.Holo.Light.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
I am working on application were most of activity are in full screen.
so i implemented it with using theme.
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">#null</item>
</style>
now i stuck with the situation were in one activity i need to show status bar.
any buddy know how to forcefully made changes as it first apply the theme so how can i code to forcefully show only status bar not actionbar.
thanks
in the activity where you want the status bar, you can try this code:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
then if you have your title defined just make it visible, for example
((View) findViewById(android.R.id.title)).setVisibility(View.VISIBLE);
I have a custom title bar
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activities);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);
Which works basically fine. The problem is that until the above code is called the default title bar is shown. I don't want a title bar there at all, in other words before mine shows up no title shall show up.
Adding this to the manifest:
<application android:theme="#android:style/Theme.NoTitleBar">
leads to a force close. My manifest looks like this
<application android:icon="#drawable/icon" android:label="#string/app_name"
android:theme="#style/My_Theme">
Where I need my_Theme since it sets the background color, setting the background color in my customer theme leads to a gray area around my colored backround. So even without the force close I am not sure if the no title will help.
Any idea?
I had the same issue as you.
The issue is with something you have in your style.
Try this out:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="My_Theme">
<item name="android:windowTitleSize">35dp</item>
<item name="android:windowTitleBackgroundStyle">#android:color/black</item>
</style>
</resources>
This one is the only one for me, which prevents the default-title before my custom title is initiated:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CustomWindowTitleStyle">
<item name="android:textColor">#android:color/transparent</item>
</style>
<style name="CustomTheme" parent="#android:style/Theme.Holo">
<item name="android:windowActionBar">false</item>
<item name="android:windowTitleBackgroundStyle">#android:color/transparent</item>
<item name="android:windowTitleSize">50dp</item>
<item name="android:windowTitleStyle">#style/CustomWindowTitleStyle</item>
</style>
</resources>
First thing why are you using a custom title bar if your app has NoTitleBar? That is silly!
Needless to say, this is your problem and you must remove that flag.
Anyhow, the best way to add custom title bar is in xml only. This avoids your app double loading the title bar; which users will see.
../res/styles.xml
<resources>
<style name="AppTheme parent="#style/android:Theme.Light">
<item name="android:windowNoTitle">false</item>
<item name="android:windowTitleSize">30dp</item
<item name="android:windowTitleStyle">#layout/custom_title</item>
</style>
</resources>
Then you dont need that code about requestAnything.
you should also check whether customTitle is supported by it or not.
Boolean customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
if (customTitleSupported) {
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.custom_title);
}
Your App crashes because in your code you calling Title Bar from window features and in other side you disabling it through manifest. Basically You cant do this, its logically incorrect.
You need to modify your title bar not to remove it.