次のようなレイアウトを作成したいと思います。
(点線はテキスト ビューのベースラインです。)
したがって、主なアンカーは大きなWであり、abcはベースラインでWに揃えられ、defはabcの上にあります。
しかし、abcのベースライン アライメントを設定すると、defが下がり、見えなくなります。abcに問題はなく、完全に整列しています。
defを可視化する唯一の方法を見つけました: abcの配置を変更して、 Wの下部に配置されるようにしますが、グリフが大きいほど下の余白が大きくなるため (ベースライン間の垂直方向のスペースが増えるため)、見栄えが悪くなります。およびビューの下端)。
ベースラインの配置が特別な方法で処理されているように見えるため、レイアウトは依存ビューの正しい位置を計算できません。
私は何か間違ったことをしていますか?私のレイアウトは可能ですか?
XML は次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/w"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="W"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="100sp" />
<TextView
android:id="@+id/abc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/w"
android:layout_alignParentLeft="true"
android:text="abc"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/def"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/abc"
android:layout_alignParentLeft="true"
android:text="def"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>