Größe von ImageView bei unterschiedlichen Auflösungen

  • Antworten:4
Stefan S.
  • Forum-Beiträge: 3

06.03.2014, 18:40:05 via Website

Hallo zusammen,

derzeit Programmiere ich an einer kleinen Android-App für eine Website. In dieser App lade ich die Profilbilder der einzelnen User herunter wenn ich aufs Profil zugreife, jedoch wird es unter unterschiedlichen Auflösungen anders dargestellt.

Hier so wie es aussehen sollte:



und hier wie es dann z.B. auf dem Nexus One (Emulator) aussieht:


Mein Layout hierfür ist wie folgt:

1<RelativeLayout
2 android:id="@+id/userContent"
3 android:layout_width="match_parent"
4 android:layout_height="wrap_content"
5 android:layout_marginTop="10dp"
6 android:background="@drawable/white_item_with_shadow"
7 android:paddingBottom="10dp" >
8
9 <ImageView
10 android:id="@+id/userImage"
11 android:layout_width="wrap_content"
12 android:layout_height="wrap_content"
13 android:layout_alignParentLeft="true"
14 android:layout_alignParentTop="true"
15 android:layout_marginTop="10dp"
16 android:contentDescription="@string/user_image"
17 android:maxHeight="100dp"
18 android:maxWidth="180dp"
19 android:minHeight="50dp"
20 android:minWidth="90dp"
21 android:scaleType="centerInside"
22 android:src="@drawable/user_image" />
23
24 <TextView
25 android:id="@+id/countryText"
26 android:layout_width="wrap_content"
27 android:layout_height="wrap_content"
28 android:layout_alignBottom="@+id/userImage"
29 android:layout_alignLeft="@+id/forumNameText"
30 android:ellipsize="end"
31 android:singleLine="true"
32 android:text="Country:" />
33
34 <TextView
35 android:id="@+id/forumNameText"
36 android:layout_width="wrap_content"
37 android:layout_height="wrap_content"
38 android:layout_above="@+id/countryText"
39 android:layout_centerHorizontal="true"
40 android:ellipsize="end"
41 android:singleLine="true"
42 android:text="Forumname: " />
43
44 <TextView
45 android:id="@+id/memberCountry"
46 android:layout_width="wrap_content"
47 android:layout_height="wrap_content"
48 android:layout_alignLeft="@+id/forumName"
49 android:layout_below="@+id/forumNameText"
50 android:ellipsize="end"
51 android:singleLine="true"
52 android:text="@string/placeholder" />
53
54 <TextView
55 android:id="@+id/forumName"
56 android:layout_width="wrap_content"
57 android:layout_height="wrap_content"
58 android:layout_alignBaseline="@+id/forumNameText"
59 android:layout_alignBottom="@+id/forumNameText"
60 android:layout_toRightOf="@+id/forumNameText"
61 android:ellipsize="end"
62 android:singleLine="true"
63 android:text="@string/placeholder" />
64 </RelativeLayout>

Danke schon einmal im Voraus,

Grüße Stefan

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

06.03.2014, 18:45:34 via Website

Z.b

android:layout_below="@+id/forumNameText"

steht nur unter dem Text aber nicht neben dem Bild, füge das einfach noch hinzu

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Stefan S.
  • Forum-Beiträge: 3

06.03.2014, 18:50:34 via Website

Mac Systems
Z.b

android:layout_below="@+id/forumNameText"

steht nur unter dem Text aber nicht neben dem Bild, füge das einfach noch hinzu

Verstehe nicht wirklich was du meinst

Antworten
Mac Systems
  • Forum-Beiträge: 1.727

06.03.2014, 23:32:10 via Website

Es feht die angabe das es neben dem ImageView stehen soll. Schau dir mal die properties von relativelayout genauer an :)

Windmate HD, See you @ IO 14 , Worked on Wundercar, Glass V3, LG G Watch, Moto 360, Android TV

Antworten
Stefan S.
  • Forum-Beiträge: 3

07.03.2014, 16:52:07 via Website

Mac Systems
Es feht die angabe das es neben dem ImageView stehen soll. Schau dir mal die properties von relativelayout genauer an :)

Dankeschön :) hab ich total übersehen mit der Abhängigkeit

— geändert am 07.03.2014, 17:15:34

Antworten