Android-textview-center-Positionierung
Ich versuche um Platz 3 textviews in der Mitte des Bildschirms, mit ein wenig Platz zwischen Ihnen da, Sie sind gonna werden als hyperlinks.
das Ergebnis so weit ist:
und der code 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" >
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="@string/about" />
<TextView
android:id="@+id/TextTabletopRPG"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Tabletop RPG"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/TextDarkHeresy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Dark Heresy"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/Text40k"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center"
android:text="40k Universe"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
Was Fragen Sie?
InformationsquelleAutor Daniel S. | 2014-12-04
Du musst angemeldet sein, um einen Kommentar abzugeben.
Wenn Sie wollen einfach nur die textviews werden horizontal zentriert, wie pro das Bild Beispiel Sie, sofern Sie dies tun können:
Wenn Sie wollen, dass Sie in der Mitte des gesamten Bildschirms ie zentriert, sowohl vertikal und horizontal, ohne die obersten Absatz müssen Sie wickeln Sie Sie in ein separates LinearLayout mit der Eigenschaft " Schwerkraft Satz wie dieser:
Beispiel:
InformationsquelleAutor Chris
versuchen Sie, hinzufügen:
android:layout_centerHorizontal="true"
zu einemLinearLayout
Mitglied.Eher mit einem Relativen layout in anycase
die margintop funktioniert, aber die android -: layout_centerHorizontal="true" funktioniert nicht
Sie können auch hinzufügen einer Tabelle und jeden einzelnen TextView in eine andere Zeile
layout_centerHorizontal="true" funktioniert nur für relative layout
InformationsquelleAutor barweiss
Voll Edit: Versuchen, diese für alle in die Mitte der Ansicht. Sie können ändern
android:gravity="center"
mitandroid:gravity="center_horizontal"
oderandroid:gravity="center_vertical"
auf RelativeLayoutHinweis: ich fügte Marge ist für eine gute Anzeige.
Siehe mein edit @DanielS. pls
InformationsquelleAutor Batuhan Coşkun
Wenn Sie wollen, um zu zeigen, das nur ein
textview
stattdessen von einem anderen Objekt versuchen Sie, diese:InformationsquelleAutor Punithapriya M
Wenn Sie möchten, es zu sein, mehr Speicherplatz, können Sie die Margen. Fügen Sie diese an die einzelnen TextView s XML:
InformationsquelleAutor Alex K