LINEARLAYOUT, VERTIKAL

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <TextView
        android:id="@+id/textview1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Eingabe"
        android:textAlignment="viewStart">

    <Button
        android:id="@+id/button1"
        android:text="Aktion"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:elevation="0dp" />

</LinearLayout >



Gewichtung
android:weightSum="30" android:orientation="horizontal"> <TextView android:id="@+id/textview1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Eingabe" android:textAlignment="viewStart" /> constant Description top Objekt oben verankert, Größe bleibt. bottom Objekt unten verankert, Größe bleibt. left Objekt links verankert, Größe bleibt. right Objekt rechts verankert, Größe bleibt. center_vertical Objekt vertikal zentriert, Größe bleibt. fill_vertical Objekt wird komplett gestreckt. center_horizontal Objekt horizontal zentriert, Größe bleibt. fill_horizontal Objekt wird komplett gestreckt. center Objekt vertikal und horizintal zentriert, Größe bleibt. fill Objekt wird komplett gestreckt. clip_vertical Zusätzliche Option. Die Ecken verschmelzen mit dem Parent. clip_horizontal Zusätzliche Option. Die Ecken verschmelzen mit dem Parent. start Setzt Objekt ganz oben hin, Größe bleibt. end Setzt Objekt ganz unten hin, Größe bleibt.
Sample

The sample show a picture and a textview.
If you click on the textview, the textview are gone and the picture is visible.
If you click on the picture, the picture are gone and the textview is visible.

Complete project
dLinearLayout2.7z







Beispielcode

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:weightSum="3"
    >
<!-- Kommentar -->
    <TextView
        android:id="@+id/textview1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Eingabe"
        android:textAlignment="viewStart" />

    <Button
        android:id="@+id/button1"
        android:text="1. Schalter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:elevation="0dp" />
    <Button
        android:id="@+id/button2"
        android:text="2. Schalter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:elevation="0dp" />

</LinearLayout >


LinearLayout, horizontal
ListView onClickListener