所以我有自定义适配器listView。我有TextView。我想从右边显示它(gravity.right)
但是,当我设置属性Gravity.Right(我也尝试动态更改它)但它不适用于单行文本和多行文本。就像在这张照片中
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Acer"
android:textColor="@color/"
android:textSize="36sp"
app:fontFamily="@font/" />
<TextView
android:id="@+id/"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/"
app:fontFamily="casual" />
<TextView
android:id="@+id/"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:text="Lorem Ipsum is simply dummy text of"
android:textColor="" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="vertical"
android:padding="15dp">
<TextView
android:id="@+id/"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="@color/"
android:textSize="36sp"
app:fontFamily="@font/" />
<TextView
android:id="@+id/"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="@color/"
app:fontFamily="casual" />
<TextView
android:id="@+id/"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textColor="@color/" />
</LinearLayout>