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

falsches Bild eingefügt :)
(Die Seite wurde neu angelegt: „thumb|Illustration of how ViewGroup objects form branches in the layout and contain View objects. The graphical user interface for an A…“)
 
(falsches Bild eingefügt :))
Zeile 84: Zeile 84:
== Make the Input Box Fill in the Screen Width ==
== Make the Input Box Fill in the Screen Width ==
The layout is currently designed so that both the EditText and Button widgets are only as big as necessary to fit their content, as shown in figure 2.
The layout is currently designed so that both the EditText and Button widgets are only as big as necessary to fit their content, as shown in figure 2.
[[Datei:Viewgroup.png|thumb|The EditText and Button widgets have their widths set to "wrap_content".]]
[[Datei:edittext_wrap.png|thumb|The EditText and Button widgets have their widths set to "wrap_content".]]
This works fine for the button, but not as well for the text field, because the user might type something longer and there's extra space left on the screen. So, it'd be nice to fill that width using the text field. LinearLayout enables such a design with the weight property, which you can specify using the android:layout_weight attribute.
This works fine for the button, but not as well for the text field, because the user might type something longer and there's extra space left on the screen. So, it'd be nice to fill that width using the text field. LinearLayout enables such a design with the weight property, which you can specify using the android:layout_weight attribute.


11.008

Bearbeitungen