In vielen verschiedenen Fragen war die Antwort, um den Text in einem TextView auszurichten, entweder: android:layout_width="match_parent"
oder um die gravity
oder textAlignment
einzustellen, aber keine dieser Optionen schien auf meinem Emulator zu funktionieren. Ich habe keine Vorschau, da es sich um Code handelt, der durch Text generiert wurde. Mit meinem aktuellen Layout bekomme ich das in meinem Emulator: Warum verhält sich der schwarze Text so seltsam? Ich möchte es ausrichten. Dies ist mein derzeitiges xml:Android TextView seltsame Textausrichtung
<?xml version="1.0" encoding="utf-8"?>
<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"
xmlns:font="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
tools:context="com.domain.citytour.activity.ImpressumActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/locationTitle"
android:textAlignment="center"
android:padding="@dimen/activity_horizontal_margin"
android:background="@color/primary"
android:textColor="@color/cardview_light_background"
android:textSize="20sp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:textAlignment="viewStart"
android:id="@+id/locationContent"
android:padding="@dimen/activity_horizontal_margin"
android:textColor="@color/primary_text"
android:textSize="14sp"/>
</LinearLayout>
</ScrollView>
</RelativeLayout>
Es tut mir leid, diese Community erneut mit dieser Frage zu belästigen.
Ich vermute, es hat etwas mit Ihrem „Code generiert Text“ zu tun. – tachyonflux
Ich stimme zu, denn ich habe Ihren Code in einem Mini-Projekt ohne jede Änderung getestet und der Text wurde linksbündig – Michael
Ich habe diese Antwort erwartet: -/ –