Well, here's the problem that puzzles me is that I really want you to help me. I am testing my application with both the amazement of HTC and the Galaxy S2 (as I know, both are high density), and both in the range of the screen are 3.7-4.3
The problem is that the same image looks different in terms of size on both screens. Surprisingly, HTC is much smaller. I have 3 downloadable folders with corresponding different sizes (which I will need here because both devices have the same density)
I did some debugging in DisplayMatrics, and I found surprise for HTC as follows:
density 1.5 desnityDPI 240 Height pixels:540 Width pixels:960 xdpi 258 ydpi 256
However, for Galaxy S2, the display metrics are:
density 1.5 desnityDPI 240 Height pixels:480 Width pixels:800 xdpi 160 ydpi 160
So can someone explain to me why the image sizes on both devices are different. Are HTC Amazing much smaller on images than on S2? Thanks you
Edit: the code used to get the DP information,
DisplayMetrics mt =getApplicationContext().getResources().getDisplayMetrics();
EDIT:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/carpet" android:clipChildren="false" android:clipToPadding="false" android:keepScreenOn="true" > <RelativeLayout android:id="@+id/relativeLayoutBottom" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:clipChildren="false" android:clipToPadding="false" > <ImageView android:id="@+id/ivBottom1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageView android:id="@+id/ivBottom2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" /> <ImageView android:id="@+id/ivBottom3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="40dp" /> </RelativeLayout> </RelativeLayout> private void initialize(ArrayList<CardSuitNumber> cards) { RelativeLayout flBottom = (RelativeLayout) findViewById(R.id.relativeLayoutBottom); player1.clearAll(); for(int i=0; i<GameConstants.MAXRANKS;i++){ player1.addCard((ImageView)flBottom.getChildAt(i)); } } public void addCard(ImageView im){ Drawable drawable = card.getCardSuitNumber().getDrawable(mActivity); im.setImageDrawable(drawable); imsetVisibility(View.VISIBLE); }
source share