Support Multiple Screen Sizes - Android Studio Tutorial

Поділитися
Вставка
  • Опубліковано 6 вер 2024
  • 🏆 My Online Courses
    ⭐Discount Coupon: LAUNCH-STEVDZA-SAN
    stevdza-san.com
    🐱‍👤 Wanna become a member? Join!
    / @stevdzasan
    📸 Instagram
    / stevdza_san
    Android devices come in all shapes and sizes, so your app's layout needs to be flexible. That is, instead of defining your layout with rigid dimensions that assume a certain screen size and aspect ratio, your layout should gracefully respond to different screen sizes and orientations.By supporting as many screens as possible, your app can be made available to the greatest number of users with different devices, using a single APK.
    And in this video I'm going to show you how your application can fit on different screen resolutions by creating layout files for each screen density.The pixel density is the number of pixels within a physical area of the screen and is referred to as dpi (dots per inch).
    This is different from the resolution, which is the total number of pixels on a screen.To ensure that your layout is flexible and adapts to different screen sizes, you should use "wrap_content" and "match_parent" for the width and height of most view components, instead of hard-coded sizes.
    Download Background Vector: bit.ly/3bmYeSK

КОМЕНТАРІ • 102

  • @fatihmeric6990
    @fatihmeric6990 4 роки тому +16

    I searched this for months but i didn't found it. Thank you very much for making this video. Sub and like!

  • @vaibhavkumarpatel6863
    @vaibhavkumarpatel6863 4 роки тому +17

    There is no other way to make the app responsive for all devices.
    I mean this is the long process to make the app responsive.

  • @maheshmahadar4780
    @maheshmahadar4780 Рік тому +1

    We can use multiple dimen files instead of multiple layout files

  • @pradeepkumarreddykondreddy7048
    @pradeepkumarreddykondreddy7048 4 роки тому +14

    Is this the only solution for supporting multiple screen sizes ?

    • @StevdzaSan
      @StevdzaSan  3 роки тому +4

      You can also create multiple dimens xml files for various margin sizes.

    • @mayank9266
      @mayank9266 3 роки тому

      @@StevdzaSan plz provide

    • @christoffere425
      @christoffere425 3 роки тому

      I did it using only weights.

  • @aritrabhattacharya7722
    @aritrabhattacharya7722 4 роки тому +5

    great tutorial. But wouldn't it be better to use ratios and constraints along with vector drawables rather than creating same screen for each dpi? In that way the UI will always scale according to the ratios and fit all devices

    • @StevdzaSan
      @StevdzaSan  4 роки тому +2

      Yes, but sadly that's not enough on more complex layouts.

    • @cyrillebournival2328
      @cyrillebournival2328 Рік тому

      I would say the same but knowing this option exist and how to use it might be helpful.

  • @hakimapg
    @hakimapg Рік тому

    very informative, but you are making login screen three times right? that sound so not efficient when building a big app.

  • @bboydarknesz
    @bboydarknesz 4 роки тому +3

    Soo.. If we want to add new / modified View, we do the same things many times? 🙊🙊🙊

  • @hashimal-haddadi4877
    @hashimal-haddadi4877 4 роки тому +3

    Brilliant , This is how tutorials should be

  • @Goad2
    @Goad2 7 місяців тому

    So when I make any update to the app I need to do manually for all the device resolutions?

  • @MohammedMansour64
    @MohammedMansour64 4 роки тому

    thank you sir , you're videos are very clear and straight to the point . keep going !

  • @ilikecats45648
    @ilikecats45648 3 роки тому

    Thank you so much, that really helped me understand what i was missing. Just one question, why you don't use any Density?

  • @durgeshsawant497
    @durgeshsawant497 3 роки тому +1

    So if u have 20 screens you create 60 xmls to support those 3 densities ..
    Is there a way we don't have to go through this tedious process

    • @StevdzaSan
      @StevdzaSan  3 роки тому

      Other way is to declare different size values in dimens.xml. Each dimens.xml with different qualifier like in layouts.

  • @sabrinafeliz4822
    @sabrinafeliz4822 3 роки тому

    Hello sir i need to Know how to résolve the same problem but the view (table. Button) are create programmatically please help me

  • @rizkiadisaputra5971
    @rizkiadisaputra5971 4 роки тому +1

    how did you know, if nexus S using High density not XXX-Density, how do you check it ?

    • @Blackops1990
      @Blackops1990 3 роки тому +1

      In Device Manager it tells you under resolution

  • @raihanchaira9653
    @raihanchaira9653 7 місяців тому

    I wanna ask something, is that not make the code boilerplate??

  • @hassesponnys8433
    @hassesponnys8433 Рік тому

    Great video and a really professional info section. Great job my man

  • @ayushraj5672
    @ayushraj5672 2 роки тому

    In which software did you create you design 0:09 . Kindly reply with the name of that software as soon as possible...

  • @AllmightC94
    @AllmightC94 4 роки тому +1

    I have 2 devices with different sizes but they both have the same xhdpi , when i run my app they look different different, why is that, help please

    • @StevdzaSan
      @StevdzaSan  4 роки тому

      For more info, read this: developer.android.com/training/multiscreen/screensizes

    • @ireshanadeeshani7534
      @ireshanadeeshani7534 4 роки тому

      @ Brian Puron, same problem is occured me.were you able to resolve it?.if you have an idea help me.

  • @antomicawad6377
    @antomicawad6377 4 роки тому +1

    Cool this is topic i have been waiting for !! Thank you

  • @ramukattimani
    @ramukattimani 2 роки тому

    What does error "E/MultiWindowProxy: getServiceInstance failed!" mean?
    please help me regards this

  • @ValdaXD
    @ValdaXD 4 роки тому +1

    Oh. A video in english. Take your like

  • @xphis0528
    @xphis0528 Рік тому

    great video! Question How does a device know which layout file to display? Do I need to program that logic in the kotlin file?

  • @deepakshetter6504
    @deepakshetter6504 2 роки тому

    What to do when two phones with the same density have different screen sizes?

  • @neohezzy2799
    @neohezzy2799 3 роки тому

    Why not choose the any density option when creating activities with the same same background so as to avoid maximizing and minimizing?

  • @hafizegungor2854
    @hafizegungor2854 4 роки тому +2

    thank you it helped a lot!

  • @joshuageorge7246
    @joshuageorge7246 3 роки тому

    Very easy to understand! Thank you simplifying this topic

  • @meetgurl
    @meetgurl 2 роки тому

    This tutorial helps me a lot ! thank you sir!

  • @superno1bidi
    @superno1bidi 4 роки тому +1

    Sir make a video on searchview on recycleview

  • @kkiran-zk8ed
    @kkiran-zk8ed 3 роки тому

    Why can't you use different dimensions based on density

  • @MrIMacro
    @MrIMacro 3 роки тому

    Thanks, but why don't you just export from xd for Android. It will export that background in different resolutions, and will also do everything for you.

  • @hex24
    @hex24 4 роки тому

    Does wrap-content, match-parent, weights usage will prevent from using differend layout?

  • @windroid_
    @windroid_ 4 роки тому

    I added all different screen sizes but when i run my project the main_activity.xml is never used! I tried multiple devices in the emulator but never managed to use it! should I delete the main_activity.xml ?!

  • @terlanabaszade9221
    @terlanabaszade9221 2 роки тому

    Hello bro. Please help me. How can i calculate all dps in the each layout file??

  • @crazycock2263
    @crazycock2263 Рік тому

    The file is no longer available

  • @haithamwehbi6552
    @haithamwehbi6552 4 роки тому

    whats the difference between density and size when you create new xml file?

  • @muzamilhaq7411
    @muzamilhaq7411 3 роки тому

    which is best multi screen size, Smallest widht (SW600),or Density

  • @mouzinu
    @mouzinu 2 роки тому

    Great tutorial, thank you so much!

  • @alekseimulin6151
    @alekseimulin6151 3 роки тому

    Really curious what is the program name used to export to SVG?

  • @iszaffar
    @iszaffar 4 роки тому +1

    Great video dude 👍🏽

  • @mehdigavanji5443
    @mehdigavanji5443 2 роки тому +1

    Thank you so much

  • @mw9463
    @mw9463 4 роки тому +1

    thanks for the video :) I have one question. Is it really important to save background file as .svg? Won't it work on .png?

    • @StevdzaSan
      @StevdzaSan  4 роки тому +4

      Using vectors has many benefits, less apk size, pixel perfect images and better performance.

    • @mw9463
      @mw9463 4 роки тому

      @@StevdzaSan Thanks for answer. So I'm gonna make some changes in my app !

  • @sachinsrivastava2056
    @sachinsrivastava2056 4 роки тому

    Having images of all dpi's VS creating multiple screen size layout.....which one is bettter or which one should be used at which moment

    • @StevdzaSan
      @StevdzaSan  4 роки тому

      Multiple layouts and preferably vector assets.

    • @sachinsrivastava2056
      @sachinsrivastava2056 4 роки тому

      @@StevdzaSan I'm confused when to use all pixel size images and when to use multiple layout for single screens

  • @rexwan561
    @rexwan561 3 роки тому

    How can I handle same density with different screen size?

  • @chechent3706
    @chechent3706 4 роки тому

    excellent work, could you tell me the name of the software I use to design in the background vector?

  • @jumps63
    @jumps63 4 роки тому

    Ne znam hoces li vidjeti komentar, ali pozdrav iz Hrvatske. Naisao sam slucajno na tvoj kanal i mogu ti reci samo nastavi!

  • @RajeshYadav-zv2uo
    @RajeshYadav-zv2uo 4 роки тому

    Which site use for design please asked

  • @cristimanolache5890
    @cristimanolache5890 3 роки тому

    If I have five interfaces is this method efficient?

  • @begmyratmammedov9357
    @begmyratmammedov9357 3 роки тому

    Brilliant! Thank you Sir

  • @fernandocarlos9477
    @fernandocarlos9477 4 роки тому

    so damn good tutorial sir, suscribed inmediatly, keep going!

  • @mockingspyhd6099
    @mockingspyhd6099 3 роки тому

    Guys, I have created Low Density, then I install 2 device which is LDPI, but each other have different layout design and didn't match the layout which I created. why? how support all resolutions?

    • @mockingspyhd6099
      @mockingspyhd6099 3 роки тому

      P.S I have RecyclerView which I want to show current DPs on the screen

  • @vuongqtvn
    @vuongqtvn 3 роки тому

    Thank you nice tutorial keep it up

  • @artemii8672
    @artemii8672 3 роки тому

    Hello, what i need to do with a lot of xml files? add one by one?

  • @Robert723
    @Robert723 3 роки тому

    Great video! Thanks a lot!

  • @Smietsde
    @Smietsde Рік тому

    Thank you

  • @arqamsidd
    @arqamsidd 4 роки тому +1

    Nice, so we always have to make different XMLs to support multiple DPIs
    There's no special layout (relative, linear etc) which would adjust the layout according to screen size?

    • @StevdzaSan
      @StevdzaSan  4 роки тому +4

      Well you could use match parent for a view instead of using fixed dimensions, that way the view will expand everytime your app is running of different screen sizes or even on landscape mode. However for more complex layouts you would use multiple layout files.

  • @bboydarknesz
    @bboydarknesz 4 роки тому

    Umm,, how did you handle image size that come from api?
    Maybe like for a banner? It usually have fixed height in android. What is the better solution for this? Thanks

    • @StevdzaSan
      @StevdzaSan  4 роки тому

      Use glide library. I have made a video about that

  • @un_known7299
    @un_known7299 4 роки тому

    Should I repeat this method for any layout for example if I made Recycleview when I made the custom layout for it should I make it 4 times hdpi and xhdpi ...

    • @gajendrapandeya5081
      @gajendrapandeya5081 4 роки тому +1

      Basically recycler view fits well in all devices. You have to worry about your startup Screens

    • @un_known7299
      @un_known7299 4 роки тому +1

      @@gajendrapandeya5081 thanks bro 🌹

  • @marsadch9397
    @marsadch9397 4 роки тому +1

    Awesome video

  • @Arzacks
    @Arzacks 4 роки тому

    Super fast but super good haha !
    Thanks

  • @benjaminjr.togonon3827
    @benjaminjr.togonon3827 4 роки тому

    Thank for the Tutorial :)

  • @md.asrafuzzaman1363
    @md.asrafuzzaman1363 4 роки тому

    wow. That's amazing video... Thanks

  • @ireshanadeeshani7534
    @ireshanadeeshani7534 4 роки тому

    Thanks .Great video

  • @skaterope
    @skaterope 4 роки тому +2

    perfect simple and clear !

  • @MyJuli1000
    @MyJuli1000 4 роки тому

    Thanks dude

  • @princeampofo9056
    @princeampofo9056 4 роки тому

    Awesome this is a very useful video, please can you make a video on how to upload list of images to firebase

    • @StevdzaSan
      @StevdzaSan  4 роки тому +3

      I'm planning to make a full course for Firebase realtime database and firestore in the future.

    • @princeampofo9056
      @princeampofo9056 4 роки тому

      @@StevdzaSan I really appreciate you replying....Thanks

  • @yurandejesus7656
    @yurandejesus7656 2 роки тому

    Awesome!

  • @contractcenter965
    @contractcenter965 3 роки тому

    What the application name?

  • @mahirbird9071
    @mahirbird9071 4 роки тому +1

    Thanks for your great tutorials. Sub and like

  • @HARSHRANAYT
    @HARSHRANAYT 3 роки тому

    thanks!

  • @yerbolkabzitov9216
    @yerbolkabzitov9216 4 роки тому

    Thanks!

  • @mohammadjohari8074
    @mohammadjohari8074 4 роки тому

    Thank you

  • @marc988
    @marc988 2 роки тому

    You sure are teaching us great stuff and thanks but... do we have to do that for every single xml layout that will be shown in our app? 🙄
    is there any way to make this automatically?

  • @abhilashdharavath6901
    @abhilashdharavath6901 4 роки тому

    So the question is, which screen you gonna publish to playstore? I don't think it's the right solution.

    • @StevdzaSan
      @StevdzaSan  4 роки тому

      Among many different layouts, Android OS automatically choses the right one for your smartphone.

  • @edmoods
    @edmoods 3 роки тому

    Would've been better without the music. It's distracting

  • @radhiosoftifybd8982
    @radhiosoftifybd8982 3 роки тому +1

    Damn!

  • @comiccoder9257
    @comiccoder9257 4 роки тому +1

    First viewer

  • @shakilahmed6870
    @shakilahmed6870 3 роки тому

    you just messed up the tutorial...remember not everyone is expert as you