• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Scale app to all phones

Thijmen

Lurker
Hey guys,

quite new to the android studio development, currently i'm just working out the basics.
How do i get the app to scale to each screen size, so the images resize such that it looks the same on each device?

Currently it looks like this in the editor:
7446f4131093ba31c20ef392952d2bf6.png


Where leftmost and middle is the editor, and right is the emulated phone.
As you can see the squares are spaced but i don't want this.
i just want them to be equal spaced but also the same size compared to the screen size.
 
You can create multiple layouts for different screen sizes as well as landscape layouts if needed. You should also try to never hardcode any sizes for views and text. Instead use:

android:layout_width="match_parent"
android:layout_height="wrap_content"

When you do need to hardcode a size use dp for any views and sp for any text so that android can do proper scaling on it's own. It's actually pretty easy, but a fairly long tutorial to teach someone how to do proper app scaling so I'll post this link to what I think is the best tutorial on this subject.

https://developer.android.com/training/multiscreen/screensizes

Good luck
 
Back
Top Bottom