372
Bearbeitungen
(Neue Version von externer Quelle importiert) |
(Neue Version von externer Quelle importiert) |
||
(3 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 139: | Zeile 139: | ||
To improve the layout efficiency when you specify the weight, you should change the width of the <code>EditText</code> to be zero (0dp). Setting the width to zero improves layout performance because using <code>"wrap_content"</code> as the width requires the system to calculate a width that is ultimately irrelevant because the weight value requires another width calculation to fill the remaining space. | To improve the layout efficiency when you specify the weight, you should change the width of the <code>EditText</code> to be zero (0dp). Setting the width to zero improves layout performance because using <code>"wrap_content"</code> as the width requires the system to calculate a width that is ultimately irrelevant because the weight value requires another width calculation to fill the remaining space. | ||
Here’s how your complete activity_my. | Here’s how your complete <code>activity_my.xml</code> layout file should now look: | ||
''res/layout/activity_my.xml'' | ''res/layout/activity_my.xml'' | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> | ||
Zeile 163: | Zeile 163: | ||
This layout is applied by the default <code>Activity</code> class that the SDK tools generated when you created the project. Run the app to see the results: | This layout is applied by the default <code>Activity</code> class that the SDK tools generated when you created the project. Run the app to see the results: | ||
# In Android Studio, from the toolbar, click Run | # In Android Studio, from the toolbar, click '''Run'''. | ||
# Or from a command line, change directories to the root of your Android project and execute: | # Or from a command line, change directories to the root of your Android project and execute: | ||
#: <code>ant debug</code> | #: <code>ant debug</code> | ||
#: <code>adb install bin/MyFirstApp-debug.apk</code> | #: <code>adb install bin/MyFirstApp-debug.apk</code> | ||
Continue to the next lesson to learn how to respond to button presses, read content from the text field, start another activity, and more. | Continue to the next lesson to learn how to respond to button presses, read content from the text field, start another activity, and more. | ||
{{TNT|Android Training/Attribution}} | {{TNT|Android Training/Attribution}} |