How to add padding to the android screen? - android

I want to add black padding (a thick black border) to the android screen such that every app is displayed with the padding around it. I know how to do this for my app but how do I do this such that when my app is running in background the display is padded?

I don't believe this is possible unless you're willing to create and run a custom ROM.

Thankfully, this is not possible for the average non-ROM third party Android developer.
The screen on mobile devices is actually very limited, and when programming for the mobile environment, you have to learn to get away from the windows metaphor used by traditional desktop PCs.
On the other hand, may be your app could pretend it is running in the background, but still stay in the foreground with its transparency enabled. And perhaps if you can't do something, may be you can find a way to fake that something for your users.
Also, note that the default home launcher is capable of doing something similar to what you want, but only for widgets. And if being able to run widgets is sufficient for you, perhaps you could write your own launcher application that can embed widgets.

Related

Remove launcher app icon background

I've been developing an app to android for a while and I've been trying different devices with multiple screens dimensions and different OSes.
I was testing the app within a Wiko Robby and I've noticed that the app icon had a background added that on previous devices weren't present.
The right side icon is owned by the OS, whilst the left one is mine. The background I would like to remove is that subtle rounded corner box background that was added the the background of the icon.
I've been searching and what I want can be achieved by installing 3rd party apps to edit the OS theme, but I don't want to do that, nor asking the users to do so.
Is there anyway I can remove the background?
This is not possible, unfortunately. This feature is entirely managed by the home screen and developers have no control over it.
I don't think that you should worry about it, though. The user is probably used to see this background behind 3rd party app icons and he will probably not even notice it on your app. I would even argue that it can be disturbing for the user if your icon was displayed without this background, as this could led him to believe that your app is a system app.

How to check if an Android OS is forcing an application icon background color?

I am working with a team to develop a cross-platform application on mobile, and we're using Visual Studio 2015 and Xamarin.Forms v2.3.2.127.
We have already created the application icons that we need for the three different platforms (Android, iOS, UWP) and each one follows the native platform specifications.
There's only one more problem that we have faced, and I would like to know if there's any answer for my problem. Some of the devices that run Android OS forces the application icon to have a squared background, and they seem to give arbitrarily colours for the background (please check the image afterwards). We don't want to change the application icon by itself for Android so we're looking for a better way.
Is there any way in Xamarin to be able to detect that the device is adding a coloured background for the application icon so we can provide it with the icon that we want, or at least change the colour the device is going to use?
As you can see, Whatsapp, Facebook and Dropbox icons are all modified and given a squared coloured background.
Thanks in advance for any help that could be given.
Regards, Paul.
This is a custom launcher / icon pack's doing. Most likely the manufacturer's doing(LEAGOO). You may notice that "Known" apps will have a custom icon, but if you created a custom app it might look much different with a random background and perhaps an icon transformation of some sort.
It might be worth getting a stock Android device to ensure your Icon looks great on stock Android as you'll never know what different launchers(bloatware) will do to your app's icon.
If the OEM has a way to interop with it, then by all means that would be the easiest way to customize this behavior. However most launchers are included in the OEM's package/bloatware.

Test Android Wear apps on phone?

Interestingly enough, I noticed that when developing, I can choose to run a Wear app on the phone instead of a Wear device. It looks the same--just huge, of course.
Based on https://plus.google.com/+AndroidDevelopers/posts/QhWQArNDfS3, I gather I could use ADB to make the phone screen small enough to do a fair imitation of a rectangular smartwatch...
But what about testing for round Android Wear devices? Is there something I can do to the phone (or a rectangular Android Wear device, for that matter) to make it show as a circle (and even better, identify as a round device to Android Wear) in order to test the round interfaces?
Yes, there's always cutting a round hole out of a page and holding that over the device, but that's obviously far from ideal.
You can test your app on a round emulator. Here are instructions how to do this: https://developer.android.com/training/wearables/apps/creating.html
EDIT:
About round and forcing round on a square device: you can try to pretend that the device is round, but it's a little hacky and ugly.
In your Activity you need to implement inset listener and then use reflection to change WindowInsets.mRound field. Then dispatch the insets further down the hierarchy. This will trick your views to think that the device is round.
Check this article about handling square and round: http://gruszczy.blogspot.com/2015/03/handling-round-screens-using.html It describes how insets with the information about device display type are delivered.

How to make Android app widgets visually consistent with shortcuts

My Samsung Galaxy S2 running Android Ice Cream Sandwich has nice little counters that appear on the home page shortcuts for Mail etc. telling me how many new messages there are waiting. That's just the behaviour that I want for my own app.
If I've read the Android docs and related questions in SO right, that behaviour is not exposed through Android, but is provided by the launcher itself, so it can't be done directly.
But I have produced the behaviour that I want using an app widget. Now I'm left with the problem of making the app widget layout visually consistent (alignment, text appearance) with the appearance of the regular shortcuts. I can't see a sensible robust way to to this. Anyone?
(Otherwise it looks as though I'll have to make the app widget look sufficiently unlike a shortcut that visual consistency isn't an issue.)

Possible to make setSystemUiVisibility() affect the entire system, rather than just your app?

I was hoping to make an app which dimmed the soft buttons to dots on the Galaxy Nexus, using the code from this answer. For completeness, this is the code:
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
Here's the question, is it possible for the app to make this setting system-wide rather than just while the app has focus? So ideally the app would run in the background and would keep View.SYSTEM_UI_FLAG_LOW_PROFILE as the default as long as it's running, for any and every app that you open (unless that app specifically overrides it, I suppose). Is this possible or does this fall outside the realm of what an Android app has permission to do?
A sample use case is this: I use the "Screen Filter" app to reduce brightness a lot for nighttime ebook reading or misc app usage, but the soft buttons are still very bright and distracting, so I wanted to make an app that would dim the soft buttons system-wide while running (like how "Screen Brightness" reduces screen brightness system-wide while running) so this wouldn't be a problem.
As CommonsWare states, it's not possible for an application to change this setting. It's an Activity based setting, that must be set for every single Activity, if you want to make it fullscreen, hide the soft keys, etc.
It's also worth pointing out that you should probably refrain from using it in all your application activities. It's really only meant for games, video players and other applications that need to enter this "low profile" state.
Feel free to accept CommonsWare's answer - I just thought I'd give you a bit of background info on the subject.
is it possible for the app to make this setting system-wide rather than just while the app has focus?
No.

Categories

Resources