笔者对齐的报价,如果有房的最后一行文字,否则把它放在新行放在、把它、有房、笔者

2023-09-06 04:50:15 作者:别低头,王冠会掉

以上是我想要的输出的一个例子。请注意,由John对准到右侧上的报价的最后一行。

Above is an example of the output I want. Notice that "by John" is aligned to the right on the last line of the quote.

如果没有足够的空间,那么我想作者出现在一个新的生产线,但还是右对齐。

If there's not enough space, then I would like the author to appear on a new line, but still be right aligned.

推荐答案

使用这样的:希望这会工作,你

use this : hope this will work you

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:orientation="horizontal"
android:padding="5dip" >

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    >

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="2dp"
        android:text="Loren ipsum Loren ipsum Loren ipsum Loren ipsum Loren ipsum Loren  Loren n ipsum Loren ipsum Loren ipsum Loren  Loren ipsum"
        android:textColor="#454545"
        android:textSize="9sp" />

    <TextView
        android:id="@+id/by"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_marginRight="15dp"
        android:text="by john"
        android:textColor="#454545"
        android:layout_marginTop="14dp"
        android:textSize="9sp" />
</RelativeLayout>