Als «android-linearlayout» getaggte Fragen

LinearLayout ist eines der Grundlayouts in Android. Es ordnet seine Kinder horizontal oder vertikal nacheinander an.



5
Android - TextView horizontal in LinearLayout zentrieren
Ich habe das folgende Grundlayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/title_bar_background"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:textAppearance="?android:attr/textAppearanceLarge" android:padding="10dp" android:text="HELLO WORLD" /> </LinearLayout> <LinearLayout> Es scheint, dass die XML korrekt ist, aber der Text ist nach links ausgerichtet. Die Textansicht nimmt die gesamte Breite des übergeordneten Elements ein …

7
Wie kann ich Ellipsen in meiner Textansicht anzeigen, wenn sie größer als die 1-Zeile sind?
Ich habe das folgende Layout, das nicht funktioniert: <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" android:id="@+id/experienceLayout" android:background="#ffffff" android:layout_height="match_parent" android:paddingLeft="6dp" android:paddingRight="6dp" android:paddingBottom="6dp" android:paddingTop="6dp"> <TextView android:layout_weight="1" android:id="@+id/experienceLabel" android:text="Experience" android:layout_height="wrap_content" android:textColor="#000000" android:layout_width="wrap_content" android:textStyle="bold"> </TextView> <TextView android:id="@+id/experienceTextView" android:text="TextView" android:layout_height="wrap_content" android:textColor="#000000" android:layout_width="wrap_content" android:ellipsize="end" android:lines="1" android:maxLines="1" android:singleLine="true" android:fadeScrollbars="false"> </TextView> </LinearLayout>

20
Wie gruppiere ich RadioButton aus verschiedenen LinearLayouts?
Ich habe mich gefragt, ob es möglich ist, jedes einzelne RadioButtonin einem Unikat zu gruppieren, wobei RadioGroup dieselbe Struktur beibehalten wird. Meine Struktur sieht folgendermaßen aus: LinearLayout_main LinearLayout_1 RadioButton1 LinearLayout_2 RadioButton2 LinearLayout_3 RadioButton3 Wie Sie sehen können, ist jetzt jeder RadioButtonein Kind von unterschiedlichemLinearLayout . Ich habe versucht, die folgende …

11
Wie füge ich einem horizontalen LinearLayout einen (vertikalen) Teiler hinzu?
Ich versuche, einem horizontalen linearen Layout einen Teiler hinzuzufügen, komme aber nicht weiter. Der Teiler wird einfach nicht angezeigt. Ich bin ein absoluter Neuling mit Android. Dies ist mein Layout-XML: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/llTopBar" android:orientation="horizontal" android:divider="#00ff00" android:dividerPadding="22dip" android:showDividers="middle" > <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:text="asdf" …

6
Layoutorientierung im Code
Ich habe diesen Code in meiner Anwendung: LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); und ich möchte nur die Ausrichtung des LinearLayout auf vertikal setzen. Das Äquivalent in XML ist: android:orientation="vertical" Wie kann ich das im Code ohne XML machen?

13
Wie zeige ich Schatten um das lineare Layout in Android?
Wie kann ich Schatten für mein lineares Layout anzeigen? Ich möchte einen weiß gerundeten Hintergrund mit Schatten um das lineare Layout. Ich habe das bisher gemacht. <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="10dp" android:background="@xml/rounded_rect_shape" android:orientation="vertical" android:padding="10dp"> <-- My buttons, textviews, Imageviews go here --> </LinearLayout> Und round_rect_shape.xml im XML-Verzeichnis <?xml version="1.0" encoding="utf-8"?> <shape …

8
Lineares Android-Layout - Wie halte ich das Element im unteren Bereich der Ansicht?
Ich habe eine, TextViewdie ich am Ende einer Landschaftsaktivität anheften möchte, die LinearLayoutmit vertikal angeordneten Elementen verwendet wird. Ich habe android:gravity="bottom"die Textansicht festgelegt, aber sie befindet sich immer noch gerne direkt unter dem letzten Element des LinearLayoutgenauen Inhalts, den ich nicht möchte. Irgendwelche Vorschläge?
Durch die Nutzung unserer Website bestätigen Sie, dass Sie unsere Cookie-Richtlinie und Datenschutzrichtlinie gelesen und verstanden haben.
Licensed under cc by-sa 3.0 with attribution required.