I know that the Internet is overloaded with questions about DPI px inches and so on. But after hours of browsing the Internet, my situation does not seem to happen to anyone else!
I have 2 custom builds with android studio which are mdpi. BUT one device has 3.65 inches and the other device is 10.1 inches.
I created a folder with 2 images 250x125 with a resolution of dpi 160 dpi
If I usually declare my 2 images in my XML with dp units instead of pixels ... I would suggest that the result should be the same on both screens?
Well, it looks like the images remain the same size and don’t look @ how many inches on the device
So that everything is clear: What do I need to change in my resources or my code so that my layout is the same for different Inch sizes?
This is my good layout for my mdpi 10.1 tablet:

This is my bad layout for my mdpi 3.65 device

How can I make sure that even on a 3.65-inch screen, the buttons are scaled to the same PROPORTIONS as 10.1. Not inches ... not pixels ... proportions ....
This is my xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="center">
<Button
android:id="@+id/buttonEnglish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/english"
android:layout_marginBottom="5sp"
android:layout_marginLeft="5sp"
android:layout_marginRight="2sp"
android:layout_marginTop="0sp" />
<Button
android:id="@+id/buttonNederlands"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/nederlands"
android:layout_marginBottom="5sp"
android:layout_marginLeft="20sp"
android:layout_marginRight="5sp"
android:layout_marginTop="0sp"
/>
</LinearLayout>
I'm desperate ... Thanks in advance
source
share