Größen angabe Min und Max/ Allgemein Layout

  • Antworten:2
Flo Biber
  • Forum-Beiträge: 24

17.04.2013, 13:32:31 via Website

Hallo,

kann mir einer von euch sagen wo der genau Unterschied/die genaue Bedeutung von MinWidth und MaxWidth ist?
Welche größe hat das Widget den letzendlich wirklich?

Ich komme nämlich bei folgendem Prolem nicht weiter:
Ich möchte ein Widget Programmieren. Welches eine kleine Tabelle aus 3x2 Felder besteht. Und größen änderbar sein soll es auch und die wichtigste eigenschaft: es soll QUADRATISCH sein... Köönt ihr mir da helfen?

Mein Probelm ich bekomme alles einigermaßen hin außer:
- Quadratisch... Bei mir sind die einzelnen TextViews Quatratishc und folge davon nicht das ganze Widget.
- Mitwachsende Schriftgröße...

Mein bisheriges Layout:

1<LinearLayout xmlns:android="*****android.com/apk/res/android"
2 android:layout_width="fill_parent"
3 android:layout_height="fill_parent"
4 android:clickable="false"
5 android:typeface="serif"
6 android:gravity="center_vertical|center_horizontal"
7 android:textSize="@dimen/FontSize"
8 android:orientation="vertical"
9 android:textAlignment="center" >
10
11 <!-- Reihe 1 -->
12 <LinearLayout
13 android:layout_width="fill_parent"
14 android:layout_height="wrap_content"
15 android:layout_weight="1"
16 android:background="@color/Background"
17 android:gravity="center_vertical|center_horizontal" >
18 <TextView
19 android:id="@+id/R00C00"
20 android:layout_width="fill_parent"
21 android:layout_height="fill_parent"
22 android:layout_weight="1"
23 android:textColor="@color/FontColor"
24 android:gravity="center_vertical|center_horizontal"
25 android:textSize="@dimen/FontSize"
26 android:text="@string/Punkt" />
27 <TextView
28 android:id="@+id/R00C01"
29 android:layout_width="fill_parent"
30 android:layout_height="fill_parent"
31 android:layout_weight="1"
32 android:textColor="@color/FontColor"
33 android:gravity="center_vertical|center_horizontal"
34 android:textSize="@dimen/FontSize"
35 android:text="@string/Leer" />
36 <TextView
37 android:id="@+id/R00C02"
38 android:layout_width="fill_parent"
39 android:layout_height="fill_parent"
40 android:layout_weight="1"
41 android:textColor="@color/FontColor"
42 android:gravity="center_vertical|center_horizontal"
43 android:textSize="@dimen/FontSize"
44 android:text="@string/Leer" />
45 </LinearLayout>
46
47 <!-- Reihe 2 -->
48 <LinearLayout
49 android:layout_width="fill_parent"
50 android:layout_height="wrap_content"
51 android:layout_weight="1"
52 android:background="@color/Background"
53 android:gravity="center_vertical|center_horizontal" >
54 <TextView
55 android:id="@+id/R01C00"
56 android:layout_width="fill_parent"
57 android:layout_height="fill_parent"
58 android:layout_weight="1"
59 android:textColor="@color/FontColor"
60 android:gravity="center_vertical|center_horizontal"
61 android:textSize="@dimen/FontSize"
62 android:text="@string/Punkt" />
63 <TextView
64 android:id="@+id/R01C01"
65 android:layout_width="fill_parent"
66 android:layout_height="fill_parent"
67 android:layout_weight="1"
68 android:textColor="@color/FontColor"
69 android:gravity="center_vertical|center_horizontal"
70 android:textSize="@dimen/FontSize"
71 android:text="@string/Leer" />
72 <TextView
73 android:id="@+id/R01C02"
74 android:layout_width="fill_parent"
75 android:layout_height="fill_parent"
76 android:layout_weight="1"
77 android:textColor="@color/FontColor"
78 android:gravity="center_vertical|center_horizontal"
79 android:textSize="@dimen/FontSize"
80 android:text="@string/Leer" />
81 </LinearLayout>
82</LinearLayout>

Vielen Dank

Flo

— geändert am 17.04.2013, 14:05:27

Antworten
Michael H
  • Forum-Beiträge: 127

17.04.2013, 13:48:15 via Website

Wenn man z.B. die width eines Buttons auf "wrap_content" setzt, wird dieser ja so breit dargestellt, dass der ganze Text (inkl. padding etc..) platz darin hat. Wenn du jetzt zusätzlich noch eine maxWidth setztst, wird der Button immer noch so gross dargestellt, dass der Text darin platz hat, jedoch MAXIMAL maxWidth.

Antworten
Flo Biber
  • Forum-Beiträge: 24

17.04.2013, 13:52:42 via Website

Vielen Dank das bringt mir schon ein Wenig Licht in die Angelegenheit. Kann man die Größe eines Widget konkret festlegen? Oder geht das nur über mIn/max?

Ps. Erster beitrag überarbeitet!

Antworten