Transparent Status Bar Android 4.3 - java

In the 'new' Android Version 4.3 there is a new feature. The status Bar on the top of the screen is transparent in the launcher (I'm using Samsung TouchWiz on Galaxy S3) and in some other Apps too I think (looks a little bit like the iOS 7 style).
Can you tell me how I can make the Status Bar transparent (or colored) in my own App (Eclipse, Java)?

Theme.Holo.NoActionBar.TranslucentDecor
Theme.Holo.Light.NoActionBar.TranslucentDecor
Based on the best answer here: How to make the navigation bar transparent

I'm not sure about the transparency but as of API 10 you can set a background drawable for the actionBar. (and thus a color)
In the following codesnippet I get a color based on an attribute (depending on the theme chosen)
TypedArray a = getTheme().obtainStyledAttributes(new int[]{R.attr.background_activity_color});
actionBar.setBackgroundDrawable(a.getDrawable(0));

Related

Samsung Galaxy S8 full screen mode

Latest Samsung's smartphone has interesting feature called full screen (or in marketing terms infinity display). In this mode app covers also part of display where home/back buttons are. Usual apps don't cover this area, leaving it black. But Samsung's native ones cover this area.
Question: how to achieve this effect? I mean what kind of manifest declaration or programmatic call (possibly Samsung's legacy API) should I use?
To enable new Samsung Galaxy S8 and LG G6 full screen support add to the AndroidManifest.xml under the <application> element:
<meta-data android:name="android.max_aspect" android:value="2.1" />
Where value of 2.1 is aspect ratio 18.5:9 (By default your App defaults to maximum ratio for 16:9 - 1.86). More info in: Android Blog.
Alternatively, you can set the following attribute for Application or Activity:
android:resizeableActivity="true"
Because the documentations states (link):
You do not need to set a maximum aspect ratio if an activity's
android:resizeableActivity attribute is set to true. If your app
targets API level 24 or higher, this attribute defaults to true.
to get full-screen you must overide onWindowFocusChanged method and create decorView object and add System_UI flags into it..
#Override
public void onWindowFocusChanged(boolean hasFocus){
super.onWindowFocusChanged(hasFocus);
View decorView = getWindow().getDecorView();
if(hasFocus){
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY // this flag do=Semi-transparent bars temporarily appear and then hide again
|View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN // Make Content Appear Behind the status Bar
|View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION // it Make Content Appear Behind the Navigation Bar
|View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
}
It can be turned off. I used this tutorial for my S8
How To Enable Full Screen Apps on Galaxy S8/S8+

How to hide notification icons in Android Status Bar?

I'm working on a German Learning app project, inspired by Duolingo app.
I need to make my app to be a little bit similar with this feature. It's like making the user to focus on the quiz, and ignore everything in status bar (notification bar). Now, what I need is i want to hide the icons on notification bar. Is there a way to do so?
This is what I want
And this is the fact
You can dim the status and navigation bars by setting the SYSTEM_UI_FLAG_LOW_PROFILE flag.
View decorView = getActivity().getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
https://developer.android.com/training/system-ui/dim.html
This decoration is reset whenever the keyboard is made visible, but you can watch for the keyboard being hidden (using an onGlobalLayoutListener) and resetting the flag.
You could just disable notifications for the offending apps in your device's settings menu. I'm looking for an option to hide them from the status bar while keeping notifications in the shade and on the lock screen. Apparently not on a Samsung device.

Custom Navigation Bar across application

I'm interested in an app that customizes the Android NavigationBar across all my applications. The same way that, i.e. NavBar Apps does it.
This far, I found two possibilities, but it doesn't fit exactly what I'm looking for:
SystemBarTint library (here)
It only works if you set your app to translucent, and display a background "tint" behind the NavigationBar.
setNavigationBarColor(int color) (here)
You can only use a color (and not a drawable) for the NavigationBar.
I want do an app that is always running and can set a drawable instead of the black color of the NavigationBar
I found out a way to customize the NavigationBar in (almost) all apps. (following this)
Using this permission:
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
Then I created a Service that calls:
WindowManager.addView(View v, LayoutParams p)
And my MainActivity starts this Service.
You cannot change the status/navigation bars color on all apps unless you are a rooted user and your custom rom / custom launcher supports this.
You can only change this inside you own application with any of the links you provided. But this will not extend to the rest of the device apps.
If the case is inside your own app you can do this by using setNavigationBarColor for the nacigation bar and the material design library for the status bar (set the secondaryColor on the material design.

Inconsistent menu display among various devices

I am experiencing an issue where the top action bar icons are displayed well in certain device such as Galaxy s 5, and HTC X, but where the icons are poorly displayed in other device such as Motorola Droid, and others. I am not sure where the source of the problems comes from and have included pictures below to display my error.
Use the following layout files. layout-mdpi, layout-hdpi, layout-xhdpi,layout-xxhdpi,layout-sw600dp,layout-sw720dp place images in the following respectivly. drawable-mdpi, drawable-hdpi, drawable-xhdpi,drawable-xxhdpi,drawable-sw600dp,drawable-sw720dp create actionbar.xml for all layouts with your requirements. include this actionbar in other xml you need.. use this.requestWindowFeature(Window.FEATURE_NO_TITLE); in JAVA file it will hide the default action bar.

blue and white AlertDialog in honeycomb

I want to create an AlertDialog like this :
I know that a blue and white view like this can be made by writing a custom XML file. My question is that is there a built in theme in Android (like Holo) which can be applied to get this effect.
I want to do it in an application being built for Honeycomb. The screenshot is from an Ice Cream Sandwhich emulator.
I found a solution close to this.
AlertDialog.Builder builder = new AlertDialog.Builder(activity, AlertDialog.THEME_HOLO_LIGHT);
This produces a dialog similar to the one above, except that the title is not in blue color (instead, it is in black color).

Categories