Please help me with one problem. When I change min sdk version from 3 (Android 1.5) to 4 (1.6) or higher, all buttons and textviews have the same size on multiple screens although I use dp and sp units. Why might this be?
Simple example (main.xml):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/button"
android:layout_width="300dp"
android:layout_height="300dp"
android:text="OK"
android:layout_centerInParent="true"
/>
</LinearLayout>
Screenshot from Google Nexus 7: http://s019.radikal.ru/i601/1312/fd/e769f6e3a690.png
Screenshot from Sony Ericsson Xperia Play: http://s019.radikal.ru/i600/1312/9d/6b3f580e7503.png
Create
dimen.xml
for following folder as per your requirement:values
values-hdpi
values-ldpi
values-mdpi
values-sw600dp
values-sw720dp-land
etc...and code for that
dimen.xml
and givexxxdp
as you want:then after you
xml
file like:FOR PROGRAMMATICALLY:
This also works:
This will give you:
May it'll be Helpful...
Thanks...