На многие разные вопросы ответом на выравнивание текста внутри TextView было либо: android:layout_width="match_parent"
, либо установка gravity
или textAlignment
, однако ни один из этих вариантов не работал на моем эмуляторе. У меня нет предварительного просмотра, так как это текст, сгенерированный кодом. Используя мой текущий макет, я получаю это в своем эмуляторе: Почему черный текст ведет себя так странно? Я хочу выровнять его по левому краю. Это мой текущий xml:
<?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>
Извините, что снова беспокою сообщество этим вопросом.