これに似た xml レイアウトを作成したかったのですが、xml コードがうまくいきませんでした。
これが私のxmlファイルです:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_margin="5dp"
android:layout_weight="1"
android:background="#FFFFFFFF" >
<ImageButton
android:name = "@+id/switchOriginDest"
android:src="@drawable/switchorigdest"
android:layout_height = "fill_parent"
android:layout_width = "wrap_content"
android:layout_alignParentLeft="true" />
<TextView
android:id="@+id/Origin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/rounded_edge"
android:padding="6dip"
android:hint="@string/mycurrentpos" />
<TextView
android:id="@+id/Destination"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/rounded_edge"
android:layout_below="@id/Origin"
android:hint="@string/desthint"
android:padding="6dip" />
</RelativeLayout>
私が今持っているのは
- - - - - アップデート - - - - - -
TextView の layout_width を固定数に設定すると、問題が解決しました。しかし、誰かが私からのフォローアップの質問に親切に答えてもらえますか?
コンポーネントが残りのスペースを自動的に占めるようにする0dpではありません。この場合、どうしてうまくいかなかったのでしょう。
例に示すように、赤と緑の円を作成するにはどうすればよいですか?