Hello, there is an Android application design in psd format sizes 1080x1920. Since the layout falls into the xxhdpi class, I translate the pixels into dpi during layout, dividing by 3. The dimensions of the pictures are explicitly specified, but they do not fit into the screen.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" tools:context="${relativePackage}.${activityClass}" > <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@drawable/bg" /> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/linearLayout1" android:layout_width="360dp" android:layout_height="45dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:background="@drawable/header" > <LinearLayout android:layout_width="22dp" android:layout_height="20dp" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="17dp" android:layout_marginTop="12dp" android:background="@drawable/logo" > </LinearLayout> <TextView android:id="@+id/textButer" style=" @style /buterStyle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="7dp" android:layout_marginTop="7dp" android:text="@string/buter" /> </LinearLayout> <LinearLayout android:id="@+id/linearLayout2" android:layout_width="309dp" android:layout_height="105dp" android:layout_below="@+id/linearLayout1" android:layout_marginLeft="27dp" android:layout_marginRight="25dp" android:layout_marginTop="20dp" android:paddingLeft="26dp" android:paddingRight="29dp" android:paddingTop="13dp" android:background=" @color /whiteRec" > <Button android:id="@+id/button1" android:layout_width=" @dimen /sizeGeneralButton" android:layout_height=" @dimen /sizeGeneralButton" android:background="@drawable/recipes" /> <Button android:id="@+id/button2" android:layout_width=" @dimen /sizeGeneralButton" android:layout_height=" @dimen /sizeGeneralButton" android:layout_marginLeft="26dp" android:background="@drawable/multivarka" /> <Button android:id="@+id/button3" android:layout_width=" @dimen /sizeGeneralButton" android:layout_height=" @dimen /sizeGeneralButton" android:layout_marginLeft="26dp" android:background="@drawable/children"/> </LinearLayout> </RelativeLayout> 

</ RelativeLayout>

Tell me, how to make an application with psd design correctly?

  • @ Uncle Ilya, If you are given a comprehensive answer, mark it as correct (click on the check mark next to the selected answer). - Nicolas Chabanovsky

1 answer 1

DPI does not directly match the resolution. To determine the DPI-category, you also need to know the physical size of the screen ... In addition, 1080x1920 has a 9x16 aspect ratio, device screens can easily have a different ratio (from 1x1 to 1x2, for example). Therefore, you can, for example, use weight (LinearLayout + weight) to position the elements proportionally, or use the ScrollView.