How can i make the app fullscreen on android

How can i make the app fullscreen on android
0

Hi my app is not fullscreen on android, it left out a lot of space in the screen. My device is RedMi Note 7 with a resolution of 2340x1080, my app canvas design resolution is 1920x640. When i open the app it show up a black space like in the picture. I have to set my app to fullscreen mode in device setting to make it real “fullscreen” like another app (game example). But i dont want my user to do that i want it to be default like any other app. Please help me how to do that?

error

Check fitWidth in your Canvas node.

Although what you really need to do is look into Widget components.

1 Like

I tried both your suggestion but still not solve my problem.

Tried :

Set Fit Height only, Fit Width only, Fit Width and Fit Height, Set canvas widget 4 dimension 0px.

add widget component to your background node and button node, and choose fitWidth on Canvas node

You have different screen aspect ratio between your test mobile and app canvas. 2340 / 1080 = 2.17 and 1920 / 640 = 3.
Thus you should create your textures which have the same relation between width and height as your display.
And there should be any collections of assets for different display’s ratio.
Otherwise you can’t achieve properly scaling of your textures when they will fit to the full screen size. (Textures will stretch).

I dont care about how texture showing on the screen, the problem is the entire scene is not cover 100% the width of the screen unless i choose my app to be [fullscreen] on my phone. And i set my app canvas size ratio to 3 because i hope it will fit my phone width but no, the app ratio is even less than my phone ratio which is 2.17. it’s a bit like 1.777. And i tried so many combination of widget setting but all failed to solve the problem.

I dont have this problem with android native app or react-native app or the hello world app. Dont know what happen with my project :frowning:

If you try your game on the web and you set the Responsive Design Mode of the browser dimensions to your target device dimensions, how does it look like?

If i try on browser , and on android simulator, It look correct, stretch full like my wish.

I notice that i build my project with target api level 17, if i change to level 28 it look correct on my device. But is that mean user with android 4.0, 5.0 cant run my project?

If it is looking ok on the web then its not a problem on CocosCreator but on the Android build configuration…

You can build with target api 28 and min at 17, and from 17 users will be able to run your project.

I can set it in gradle.properties right ? Btw thank all for the help, i can rest well today.

defaultConfig {

minSdkVersion MIN_SDK_VERSION
targetSdkVersion TARGET_SDK_VERSION