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

Aus Android Wiki
(Die Seite wurde neu angelegt: „== Ein Lineares Layout erstellen == # Öffne in Android Studio die Datei <code>activity_my.xml</code> aus dem Ordner <code>res/layout</code> #: Die BlankActivi…“)
 
K (FuzzyBot verschob die Seite Translations:Android Training/Eine einfache Benutzeroberfläche erstellen/5/de nach Translations:Android Training/Building a Simple User Interface/5/de, ohne dabei eine Weiterleitung anzulegen: Teil der übersetzbare…)
 

Aktuelle Version vom 18. Dezember 2015, 03:24 Uhr

Nachricht im Original (Android Training/Building a Simple User Interface)
== Create a Linear Layout ==
# In Android Studio, from the <code>res/layout</code> directory, open the <code>activity_my.xml</code> file.
#: The BlankActivity template you chose when you created this project includes the <code>activity_my.xml</code> file with a RelativeLayout root view and a <code>TextView</code> child view.
# In the Preview pane, click the Hide icon  to close the Preview pane.
# In Android Studio, when you open a layout file, you’re first shown the Preview pane. Clicking elements in this pane opens the WYSIWYG tools in the Design pane. For this lesson, you’re going to work directly with the XML.
# Delete the [http://developer.android.com/reference/android/widget/TextView.html <code><TextView></code>] element.
# Change the [http://developer.android.com/reference/android/widget/RelativeLayout.html <code><RelativeLayout></code>] element to [http://developer.android.com/reference/android/widget/LinearLayout.html <code><LinearLayout></code>].
# Add the [http://developer.android.com/reference/android/widget/LinearLayout.html#attr_android:orientation <code>android:orientation</code>] attribute and set it to <code>"horizontal"</code>.
# Remove the <code>android:padding</code> attributes and the <code>tools:context</code> attribute.

Ein Lineares Layout erstellen[Quelltext bearbeiten]

  1. Öffne in Android Studio die Datei activity_my.xml aus dem Ordner res/layout
    Die BlankActivity Vorlage, die du beim Erstellen des Projektes ausgewählt hast, enthält die Datei activity_my.xml mit einem RelativeLayout Basis-View und beinhaltet eine TextView.
  2. Klicke das Verstecken-Icon im Vorschau-Bereich, um diesen zu verbergen.
  3. In ANdroid Studio siehst du beim Öffnen einer Layout-Datei zuerst den Vorschaubereich. Beim Klicken auf ein Element in dieser Ansicht werden die WYSIWYG Tools im Design-Bereich geöffnet. In dieser Übung wirst du direkt mit dem XML arbeiten.
  4. Lösche das <TextView> Element.
  5. Ändere das <RelativeLayout> zu einem <LinearLayout>.
  6. Füge das android:orientation-Attribut hinzu und setze den Wert auf "horizontal".
  7. Entferne das android:padding- und tools:context-Attribut.