I am working on an App that captures the phone camera feed and display it into a GLSurfaceView and then in the renderer I add ImageViews to the screen in some specific coordinates.
The problem I am facing is that the camera feed in the GLSurfaceView is never full screen. In some Android versions it will put some black space horizontally in the top and bottom and in some other versions the black space will be smaller but vertical on the Left and Right of the screen.
I wanted to ask if there is any way to force fullscreen on every version ? I am fairly new to working with GLSurfaceView and nothing I tried works.
You could look into immersive mode to get rid of the system buttons if that's appropriate to your app: https://developer.android.com/training/system-ui/immersive
You should also look into the android.max_aspect manifest setting to eliminate black bars on very widescreen devices: https://android-developers.googleblog.com/2017/03/update-your-app-to-take-advantage-of.html
You should also look into supporting display cutouts (notches): https://developer.android.com/guide/topics/display-cutout/
As mentioned in the comments by BDL, if the screen and camera aspect ratio don't match, then you are going to have to have black bars, or cut off some content.
Related
I have few scenes in my project. I was able to center all of the other scenes. But i cannot center the main scene in my project. Its fine when it opened on a mobile device(probably because resolution matches i guess). but when i opened it in tablet(its an old tab "xiaomi tab 3") its always align to the right on the screen. I was able to center other scenes but i cant center the main scene to screen for some reason. project setting set as 2D and Expand. I also tried to use Control nod, canves layers, margine containers.. but nothing works. If someone can give any suggestions, Thank you in advance.
img1
https://i.stack.imgur.com/FJOHl.jpg
project
1920 x 1080
I have seen this problem, or similar, in windowed mode. I don't know if this is the exact case, but if it doesn't mess with your project, try full-screen mode.
If it's that, you can also take care of the window bar size (which is a problem because it can change from different devices), since godot will count its pixels too.
Notice that you're only having this problem in one axis.
Also, I think you could take a look into the Viewport Stretch Mode. It could mess your graphics depending of the intended result—but other projects won't even notice, so judge for yourself.
The viewport setting sets the root scene’s Viewport to the base resolution. The rendered output of the root Viewport is then scaled to the display resolution. [...]
The viewport setting is a better choice than the 2d setting when pixel-perfect precision is required, since primary rendering still occurs at the base resolution.
Support multiple devices
Scaling correctly for all devices could be an odyssey, so bon voyage.
I'm using the showcaseview library in my Android app to display a first time tutorial to new users. So far it's been fairly straightforward to get going; I have a number of different viewpager tabs at the top of the page that are getting consecutively showcased, which is great ... in portrait mode.
However when the device is rotated, or I start my app in landscape orientation, the title and content text that I have for my showcase is displayed at the bottom of the screen and it eventually overflows off the screen. The showcase text content isn't more than a sentence and I can't think I'm the first person to have this problem so I'm wondering if any one else has come across this and how they solved it?
I was thinking that since showcaseview calculates the best position for the text based on free canvas space that I could probably move my content up by reducing the radius of the showcase cirlce, although I have yet to try this.
Also, I don't want to restrict users by locking the orientation to portrait mode during the tutorial.
EDIT: I've temporarily settled for locking the screen to portrait orientation if I deem the height and width of the target device to be too small. It's not my ideal solution so I'm still keen to hear the thoughts of any showcaseview users out there.
So, I have an application that uses a canvas and animated a moving block. What I would ultimately like to do is have the camera running capturing the user's face without showing the camera screen on the app or have a box at the bottom right of my screen that showing what the camera sees.
Is it possible to have a mini screen at the bottom right of my app that is displaying the camera or does the camera have to take the full screen?
Or if it is possible just to quickly snap a picture and display a bitmap without losing my application, that would be fine also.
Any help would be great!
Thanks.
Is it possible to have a mini screen at the bottom right of my app that is displaying the camera or does the camera have to take the full screen?
It is possible, See the 1st Screenshot here. Theirs is in top left instead of bottom right, but it should work just the same. In this Qik application the full screen shows the other person you are talking with, and the small box shows the live view from your camera.
I wouldn't know how they did that, but I imagine if you follow along with Building a Camera App in the docs it would get you most the way there. You just need to adjust the size of the preview canvas, and figure out how to use the front camera instead of back.
I want to programmatically set a wallpaper to be an exact fit of the current screen.
Android fits the image to scroll as you change windows by defalt and so you never see the whole image on any one screen.
Applications like Wallpaper Wizardrii perform the function of setting the image to a single screen for the user, but I have never seen an answer on any forum that suggests how this is done.
Can any Android guru out there help - this problem has been doing my head in for nearly a week now!
You need to write a Live Wallpaper so you can render your image to the screen exactly how you want. If you just set a static image, the launcher app (or anything else showing the wallpaper) will be free to adjust it and resize and scroll. By writing a live wallpaper, you get to receive the requests from launcher about what it wants to happen to the wallpaper, and follow or ignore them as you want.
Also conceptually "make the wallpaper an exact fit for the current screen" is not even possible, because there is only one wallpaper, but two orientations (landscape and portrait) it can be shown in. That one wallpaper just fundamentally can't exactly fit both orientations.
We are writing an application for the T-Mobile MyTouch which is an Android based mobile phone. We have images that will be displayed on the default screen portrait mode (320 x 480).
Anticipating that the Android OS will be appearing on Netbooks with default landscape 16 : 9 screen format, what is the best way to handle images that are in a portrait mode format? In other words since you can't rotate the screen on these Netbooks, if you display a portrait mode image on landscape mode screen there will be large blank rectangles on either side of the image.
In terms of image resources within the application, such as is the case with background images, it is a common practice to have different image set for landscape and portrait mode, or even different screen sizes. Surely, you will adapt your layout to it, or at least have a good relative layout.
However, if you are wondering what to do when an image of an unknown size has to be drawn on the screen (e.g. in case of photo album application), it is fine to leave those black rectangles on both sides. Take a look at the behaviour of video player view on the Android Dev Phone 1. It will adapt the video frame height to landscape mode, and it will play the video in the landscape mode whether or not a portrait mode is more suitable.
You deal with it the same way you would deal with the user turning their phone sideways. This is as much a presentation decision as a UI one.
Remember Android supports using alternative layouts for identical Views. If you have a portrait layout e.g. res/layout/gallery.xml, you can create a landscape equivalent in res/layout-land/gallery.xml and Android will automatically load the latter layout file if the Activity is launched in landscape mode.
With the separate layout XML file, you can then arrange your image as you feel best fits the intent of your application (an application displaying medical images may well have different presentation priorities than one displaying a family portrait). You could for example just fill the background with a gradient, or more information that is otherwise hidden in portrait mode. It all depends on what you wish to achieve with your application and the lengths you are willing to go to to account for all possibilities.
But ultimately, provided the user can see the image in it's entirity without needing to flip their netbook on it's side, I imagine they'll be happy :)
You should design your screen with certain anchor points and then position the rest of the views in relation to those anchor points. For example if you have a screen layout which has a banner, a list of items and some buttons under the list then 2 of the ways these can be positioned on the screen:
Place banner at the top. Put the
list under it and then the buttons
under the list.
Place banner at
the top. Place the buttons at the
bottom of the screen and then the
list takes the space between the
banner and the buttons.
Layout 1) will have trouble with different screen sizes and the layout will look odd or may not appear correctly at all. Whereas, 2) gives you a better appearance for most screen sizes.