Ok here is a problem that is puzzelling me that I really would like you to help me out with. I am testing my app with both HTC amaze and Galaxy S2 (as I know both are High density) and both in the 3.7-4.3 screen range
The problem is that the same image looks different in terms of size on both screens. On The HTC amaze it is much smaller. I have my 3 drawable folders with the appropriate different sizes ( which I should need anyways here because both devices are of the same density)
I did some debugging on the DisplayMatrics and I found for HTC amaze the follows:
density 1.5
desnityDPI 240
Height pixels:540
Width pixels:960
xdpi 258
ydpi 256
However, for the S2 galaxy 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 images sizes on both devices are different. On HTC amaze images are much smaller than on the S2? Thank you
Edit: Code used to get the DP info is
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);
}