Zwei Geräte, ähnliche Dichten und doch unterschiedliche Bildgrößen?
Ok, hier ist ein Problem, das mich verwirrt, bei dem ich wirklich möchte, dass du mir hilfst. Ich teste meine App sowohl mit dem HTC amaze als auch mit dem Galaxy S2 (da ich weiß, dass beide eine hohe Dichte haben) und beide im Bereich von 3,7 bis 4,3
Das Problem ist, dass dasselbe Bild auf beiden Bildschirmen unterschiedlich groß aussieht. Auf dem HTC ist es erstaunlich viel kleiner. Ich habe meine 3 Zeichenmappen mit den entsprechenden unterschiedlichen Größen (die ich hier sowieso brauchen sollte, weil beide Geräte die gleiche Dichte haben)
Ich habe einige Fehler in der DisplayMatrics behoben und fand für HTC Folgendes erstaunlich:
<code>density 1.5 desnityDPI 240 Height pixels:540 Width pixels:960 xdpi 258 ydpi 256 </code>
Für die S2-Galaxie lauten die Anzeigemetriken jedoch:
<code>density 1.5 desnityDPI 240 Height pixels:480 Width pixels:800 xdpi 160 ydpi 160 </code>
Kann mir also jemand erklären, warum die Bildgrößen auf beiden Geräten unterschiedlich sind. Auf dem HTC sind erstaunliche Bilder viel kleiner als auf dem S2? Vielen Dank
Bearbeiten: Der Code, mit dem die DP-Informationen abgerufen werden, lautet
<code>DisplayMetrics mt =getApplicationContext().getResources().getDisplayMetrics(); </code>
BEARBEITEN:
<code><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); } </code>