Categories

Follow Us @web_learners

Monday, April 27, 2020

How to Make Android App fit all Screen Sizes | Webview App Development Series Part 14

Hi, Today I am going to show How to Make Android App fit all Screen Sizes. Last Post I have shown you How to Integrate Admob ads in Webview. Let's Start.



First, you have to go to the "AndroidManifest.xml" file for giving permission to Make Android App fit all Screen Sizes. Usually, the display of the mobile becomes small, normal, large, x-large. So, we will give all-screen supports permission. Write the following code.

Code:


Then you have to Make different files for different sizes of the display. Like in my project have a splash screen, I will make different activity file for different display sizes.

First, you have to click on the right side of the mouse, then select new-->Layout Resource File. Also, you have to give the exact same name which name has your default activity.xml file. In my case, my file name is "activity_splash.xml" in Webview App. I will provide that name in the file name scope, As you can see my splash screen has "RelativeLayout" so I have selected Root element RelativeLayout.

Then you can see on the left side has a "size" option, you need to click on that. you will see there has Small, Normal, Large, X-Large option. You have select which size you want. Then click on OK.


This way create other files. And for the landscape mode, you need to create also the same way but have written there "land" such as layout-small-land.


If you want to create a screen for a tablet, then you need to write layout-sw600dp. 600 dp used for small to 7-inch tablet screen support, for 10-inch or higher screen you need to create the same way 720dp.



Then copy the code from the original activity file, then paste the code in all the activity files in your Webview App

That's it. In the next video, the second part will be discussed which is about image fitting in Webview App according to the activity we have created here. If you face still a problem, Watch the video above and follow my guidelines. Thank you.

1 comment:

  1. What about activity_main.xml? Should we resize it too? The "No Internet Dialog" Layout is in there, right?

    ReplyDelete