I would like to show transparent status bar without using immersive mode. Just like the image below. I have tried lot of solutions however I'm unable to achieve this. Please refer the image below.
This is the output I'm looking for. Please note here that I'm looking for solution which doesn't affect navigation bar at all. I don't want any modifications to navigation bar just like image below.
Thanks in advance!
My theme:
<style name="AppTheme" parent="#style/Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
<item name="android:colorEdgeEffect">#color/color_subtitle_text</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus">true</item>
try this:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
You can use like this.
For Kotlin:
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
For Java:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
Related
I use the theme to show my WelcomeActivity
#android:style/Theme.NoTitleBar.Fullscreen
But I found it will have a period of black background when the app start
So I want to change the background of this theme
then I use...
<style name="WelcomeTheme" parent="#android:style/Theme.NoTitleBar.Fullscreen">
<item name="android:windowBackground">#drawable/welcome_img</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
</style>
Although the background is changed , the Actionbar is also showing!!
the Actionbar doesn't show when I use Theme.NoTitleBar.Fullscreen
but it's showing when I use WelcomeTheme
how should I remove the ActionBar
Thanks for your help :)
-
By the way , in my WelcomeActivity extends Activity but not ActionBarActivity
Did you try one of those?
in Activity;
getActionBar().hide();
in Fragment;
getActivity().getActionBar().hide();
1. Make you welcome activity.
2. Go to styles xml file and create a style like that:
<!-- BWelcome application theme. -->
<style name="WelcomeTheme"
parent="android:Theme.DeviceDefault.NoActionBar.Fullscreen">
<!-- Customize your theme here. -->
</style>
3. Go to manifest file and add this to your welcome activity:
android:theme="#style/WelcomeTheme"
4. Add your welcome logo in an ImageView
5. Advice: Never use Java code if you can do it with XML
Hope it helps!
You can do this way:
WelcomeActivity extends ActionBarActivity:
on onCreate();
getSupportActionBar.hide();
In Layout file:
setBackground to Parent View:
Hope this will help you.
Yeah pretty much the title. I tried different android styles, but I lose both the title and the action bar at the bottom. I also tried using
getActionBar().setDisplayShowTitleEnabled(false);
getActionBar().setHomeButtonEnabled(false);
getActionBar().setDisplayUseLogoEnabled(false);
But with this I get a blank title bar. I want to remove the title bar completely. Does anyone know a solution for this? Thanks!
If you are using Theme.Holo.Light and want to use the Theme.Holo.Light.NoTitleBarBar variant on pre 3.2 devices you can add this to your styles.xml:
<style name="NoTitleBar" parent="#android:style/Theme.Holo.Light">
<item name="android:windowActionBar">true</item>
<item name="android:windowNoTitle">false</item>
and then set it as your activity's theme:
<activity android:theme="#style/NoTitleBar" ... />
In your oncreate do this
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
I found a solution: It is pretty much
<style name="MyActionBarStyle" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:displayOptions"></item>
<item name="android:height">0dip</item>
</style>
I just sized it to zero and it works.
In my android app, I've designed some layouts to set the custom dialog. But I face some problems while making border with glittering effect.
I've set the following style to my dialog:
<style name="MyDialog" parent="android:Theme.Holo.Light.Dialog">
<item name="android:windowTitleStyle">#style/DialogWindowTitle</item>
<item name="android:windowFrame">#color/transparent</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFrame">#drawable/alertbgc</item>
In the java snippet,I added the lines as follows:
final Dialog mydialog= new Dialog(this,R.style.MyDialog);
mydialog.setContentView(R.layout.mylayout);
But with this snippets I'm getting very dark background (I used nine patch images too, but no use). Please help me providing your ideas.
Thanks in advance
I need to have the action bar hidden on application start. Then, after some user action, it has to show up again overlaying the content. Currently I turn it off in a custom style by setting <item name="android:windowActionBar">false</item>, and then call
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
getActionBar().hide();
in onCreate() of the activity.
That seems a little awkward though. Can I do all of it in xml configs?
I don't know about the hiding part, but you cna style the ActionBar as an overlay in your apps theme like this:
<style name="AppTheme" parent="#style/Theme.AppCompat">
<item name="android:windowNoTitle">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowActionBarOverlay">true</item>
</style>
I was wondering whether there is a simple way to tell Android to always use a custom style to display Dialogs.
Using themes and styles you can change the look and feel of all, say, TextViews using this piece of code when defining a theme in themes.xml:
<item name="android:textViewStyle">#style/Blue.TextView</item>
with Blue.TextView being defined in styles.xml.
Is there some way to do so for Dialogs as well ?
yes, there is. for example,
AlertDialog.Builder b = new AlertDialog.Builder(context, R.style.MyTheme);
or, if you are using a DialogFragment, just call the setStyle() method,
<style
name="Theme_Dialog_Translucent"
parent="android:Theme.Dialog">
<item
name="android:windowBackground">#null</item>
</style>
Below is the working code::
Dialog mDialog = new Dialog(this,R.style.ThemeDialogCustom);
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mDialog.setCanceledOnTouchOutside(true); //But here It is not workin
mDialog.setContentView(R.layout.popup);