Android Training/Building a Simple User Interface/de: Unterschied zwischen den Versionen

Die Seite wurde neu angelegt: „Das Layout ist aktuell so entworfen, dass beide Widgets, <code>EditText</code> und <code>Button</code>, nur so breit sind, um ihre Inhalte anzeigen zu können,…“
(Die Seite wurde neu angelegt: „Die EditText und Button Widgets haben als Breite "wrap_content" gesetzt.“)
(Die Seite wurde neu angelegt: „Das Layout ist aktuell so entworfen, dass beide Widgets, <code>EditText</code> und <code>Button</code>, nur so breit sind, um ihre Inhalte anzeigen zu können,…“)
Zeile 117: Zeile 117:
'''Hinweis''': Der Button benötigt kein <code>android:id</code> Attribut, da es im Activity-Code nicht referenziert wird.
'''Hinweis''': Der Button benötigt kein <code>android:id</code> Attribut, da es im Activity-Code nicht referenziert wird.
[[Datei:edittext_wrap.png|thumb|Die EditText und Button Widgets haben als Breite "wrap_content" gesetzt.]]
[[Datei:edittext_wrap.png|thumb|Die EditText und Button Widgets haben als Breite "wrap_content" gesetzt.]]
The layout is currently designed so that both the <code>EditText</code> and <code>Button</code> widgets are only as big as necessary to fit their content, as shown in the picture.
Das Layout ist aktuell so entworfen, dass beide Widgets, <code>EditText</code> und <code>Button</code>, nur so breit sind, um ihre Inhalte anzeigen zu können, wie im Bild zu sehen.


This works fine for the button, but not as well for the text field, because the user might type something longer. It would be nice to fill the unused screen width with the text field. You can do this inside a <code>LinearLayout</code> with the weight property, which you can specify using the [http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html#weight <code>android:layout_weight</code>] attribute.
This works fine for the button, but not as well for the text field, because the user might type something longer. It would be nice to fill the unused screen width with the text field. You can do this inside a <code>LinearLayout</code> with the weight property, which you can specify using the [http://developer.android.com/reference/android/widget/LinearLayout.LayoutParams.html#weight <code>android:layout_weight</code>] attribute.
11.008

Bearbeitungen