Tag: layout-gravity
Android layout-parameter, setzt die Schwerkraft (Ausrichtung) der eine Ansicht oder Layout innerhalb seines übergeordneten Containers.
1
Antworten
Etwas von einem Neuling hier. Ich bin über zwei Monate in der Android-Entwicklung, aber ich habe Jahre Erfahrung in der Entwicklung in anderen Umgebungen. Okay. Ich habe eine FloatingActionButton wurde nicht angezeigt, wo ich es erwartet habe
3
Antworten
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="top" <!--this line--> android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:textSize="56dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:textSize="36dp" /> </LinearLayout> Sollte nicht, die kleiner "0" t-view ausrichten, um die
3
Antworten
Ich versuche nächste LinearLayout.LayoutParams b = new LinearLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); b.gravity =Gravity.CENTER; ivOne.setLayoutParams(b); Aber dieser hat keine Arbeit, die Bild-Ansicht in der linken Seite des Layouts Versuchen RelativeLayout statt LinearLayout, RelativeLayout hat centerInParent Eigenschaft. welche Methode muss
2
Antworten
mein code <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:layout_width="fill_parent" > <LinearLayout android:id="@+id/foo" android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical" android:layout_gravity="center_horizontal" android:onClick="newItemOnclick"> <ImageView android:id="@+id/id_new_big_list_item_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/dom_logo_new" /> </LinearLayout> </LinearLayout> aber linearlayout foo Links ausrichten, die nicht in der Mitte. Was
2
Antworten
Ich habe ein problem auf diesem layout 🙁 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/cuerpo" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:orientation="vertical" > ... In java-code LinearLayout cuerpo = (LinearLayout) findViewById(R.id.cuerpo); if(align){ cuerpo.setGravity(Gravity.CENTER_VERTICAL); }else{ cuerpo.setGravity(Gravity.NO_GRAVITY); } Brauche ich layout_gravity keine Schwerkraft. InformationsquelleAutor e-info128 |
3
Antworten
Ich habe eine LinearLayout enthält eine Menge von TextViews und ImageButtons ich ausrichten möchten einige dieser Elemente nach rechts, ich hatte einen Blick auf diese und diese aber ich kann nicht Ihre Tipps, wie ich kann es
3
Antworten
Habe ich ein problem, das ist vielleicht albern, aber ich kann einfach nicht herausfinden, warum das nicht funktioniert. Grundsätzlich habe ich eine Kopfzeile in meiner Tätigkeit. Diese Kopfzeile soll zentriert sein. Layout-XML - <?xml version="1.0" encoding="utf-8"?> <LinearLayout
7
Antworten
Ich m versuchen, ein textview und einen button in linearer Anordnung mit horizontaler Ausrichtung. Die textview erscheinen soll der Ausgangspunkt und der button erscheinen soll am Ende. Ich dachte, geben der Schwerkraft Recht, die Taste würde den
5
Antworten
mein xml-code für die Ansicht der Liste in der Zeile <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:baselineAligned="false" android:orientation="horizontal" > <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="5" android:orientation="vertical" > <TextView android:id="@+id/tv_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" /> <TextView android:id="@+id/tv_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp"
4
Antworten
Warum meine TextView geht nicht, richtig? Update: Gut, jetzt habe ich nicht nur brauche, um TextView auf der rechten Seite. Jetzt ist es sehr interessant, warum layout_gravity funktioniert nicht wie erwartet, nämlich - gesetzt den View zu
2
Antworten
Ich bin zu riskieren schreiben Sie eine doppelte Frage, aber ich war die Erforschung der Antwort auf eine andere Frage, merkte ich, dass ich konnte nicht finden eine einfache Frage und Antwort enthalten, dass die Einstellung sowohl
3
Antworten
, Was Ich Versucht Habe Zu Tun Versuchte ich, meine ImageButton's layout_gravity via Java-code, wie ich will, die ImageButton werden vorgestellt wie der Weg in die Orange Rahmen im Bild unten: Den Blau Rahmen ist eine vertikale
3
Antworten
Ich habe Folgendes problem: ich habe implementiert eine HorizontalScrollView enthält in einem Fall wurde eine LinearLayout und ein ImageView. In diesem Fall wird das Bild etwa 50% der Bildschirmbreite. Also ich möchte es mittig. Leider der einzige
5
Antworten
Was ist Los mit meinem code, ich versuche, meine TextView namens "invalid"in verschiedenen Positionen (Links,rechts,center), aber die Schwerkraft (Links,rechts,center) funktioniert nicht! Meine text.xml ist <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="20dp" > <EditText android:layout_width="fill_parent" android:layout_height="wrap_content"
2
Antworten
Dies ist mein layout: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:layout_marginLeft="5dip" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:textColor="#ffffff" > </TextView> </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout3" android:layout_width="fill_parent" android:layout_height="wrap_content"
3
Antworten
Was ist der Unterschied zwischen android:textAlignment und android:gravity? InformationsquelleAutor der Frage Chrizzor | 2013-04-24
7
Antworten
Ich soll Mitte meine LinearLayout innerhalb der ScrollView. Wenn LinearLayout Höhe ist klein, es ist zentriert in Ordnung (siehe Bild #1) aber wenn LinearLayout ist die Höhe, die größer ist als der Bildschirm ist die Höhe, dann
2
Antworten
Ich habe ein multi-line EditText: <EditText android:layout_gravity="center" android:id="@+id/txtMessage" android:layout_height="wrap_content" android:layout_below="@+id/lblMessage" android:layout_width="wrap_content" android:width="250dip" android:text="" android:maxLength="760" android:lines="4"> </EditText> Nun der Inhalt ist ausgerichtet auf die Mitte. Und ich würde gerne den Inhalt ausgerichtet auf die Spitze wie dieser: vertikal
4
Antworten
Habe ich ein EditText in meiner Anwendung. Ich will richten Sie den text in dem Textfeld auf der rechten Seite anstelle der Standard-Links. Ich habe versucht, das hinzufügen android:layout_gravity="right" aber das scheint nicht zu funktionieren. andere Vorschläge
5
Antworten
Habe ich die folgenden grundlegenden layout <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> Scheint es, wie die xml korrekt ist, aber der text