I'm working on an android app that we're targeting for all screen sizes? How do i go about making my layouts? Shall i make a different layout.xml for each type of screen or is there any other "efficient" way of doing things?
Read Supporting Multiple Screens, specially the section "Best practices for Screen Independence".
Basic rules:
Edit concerning your screenshots.
<ImageButton
android:id="@+id/btnSubmit"
android:src="@drawable/submit"
android:layout_height="22dp"
android:layout_width="85dp"
android:layout_marginTop="15dp"
android:layout_below="@+id/confirmpassword"
android:layout_centerInParent="true" />
You specify here two vertical constraints that might not play well together. Instead of layout_centerInParent, try layout_centerHorizontal.
You could also give a gravity="top|center_horizontal" to your RelativeLayout. So by default the elements get centered in the view horizontally and get sticked to the top.
Also try to align firstname
below btnSignin
instead of username
. You might be lucky.
RelativeLayout is the most complicated layout to use. If you can't get it right after some time, you could simply decide to fall back on using combinations of nested LinearLayout
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With