- New -> Android project for testing the problem
Code for Test.java:
package test.density.yeah;
import android.app.Activity; import android.os.Bundle; public class TestActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
Code for main.xml:
<ImageButton android:background="@null" android:src="@drawable/icon" android:layout_width="200dp" android:layout_height="200dp"> </ImageButton>
Started emulator with settings:
Resolution - 480x800
Avstracted LCD Density - 190
RESULT:
http://cs5961.userapi.com/u68152416/-3/y_ef134df2.jpg
After that I've started emulator with such settings:
Resolution - 480x800
Avstracted LCD Density - 240
RESULT:
http://cs5961.userapi.com/u68152416/-3/y_8b99507b.jpg
Emulator settings for the first test mathes my HTC HD2 characteristics and second is the same as the HTC Sensation XL is. When running this test app on them it is the same problem. HD2 (480x800, 190dpi) - small image, Sensation (480x800, 240dpi) - huge image.
So why "density independent pixels" do not work?