私が抱えている問題は、2行にまたがるTextView
右側の2番目を揃えることです。TextView
を使用していますRelativeLayout
が、使用するlayout_toRightOf
と画面上部に表示され、追加するlayout_alignRight
と消えます。
私はこれがどのように機能するか非常に混乱しています。あなたはそれが最初のTextView
終わりに続くと思いますが、そうではありません。ああ、それwrap_content
が問題だと誰かが思った場合に備えて、幅と高さを使用しています。前もって感謝します。
XML
<TextView
android:id="@+id/edit_event_name_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18dp"
android:textStyle="bold"
android:layout_marginBottom="5dp"
android:scrollHorizontally="false"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" />
<TextView
android:id="@+id/show_event_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:scrollHorizontally="false"
android:layout_toRightOf="@+id/edit_event_name_show"
android:layout_alignBaseline="@+id/edit_event_name_show" />
編集:TextViewsで物事をうまく調整しようとして同様の問題を抱えている人には、デフォルトで方法はありません。ただし、を使用SpannableString
してそれらを使用および構築できますSpannableStringBuilder
。