私は3つのテキストブロックとスケッチに示されているようにレイアウトに収めたい画像を持っています。 (1秒間赤い線を無視してください)
(私は品質がひどいと知っています。誰かがオススメx/linux用のまともな(オープン)グラフィックエディタをお勧めできるなら、 !テキストブロックと画像の位置付け
- 相対レイアウト:))
私の考えでは、このような問題に取り組むことでした。
- 最初のテキストブロックを基準にして2番目のテキストブロックを配置します。
例えば:
android:layout_below=text1
android:layout_ (make it "float" to screen's right edge - not sure how to do that, yet.
- 第1及び第2ブロックに対する第三のテキストブロック。
例えば:
android:layout_below=text2
android:layout_alignLeft = text1
[OK]をクリックします。いいえ、画像に出ましょう。それは任意のサイズですので、私はそれを適合させることができるいくつかのアライメントについて考えました。スケッチから赤い線を見ることが分かっていれば、それに応じてイメージを整列させます。
android:layout_alignTop = text2
android:layout_alignBottom = text2
android:layout_alignLeft = text1
は、しかし、私はレイアウトを行う上で非常に良いではないと私はこのように、多かれ少なかれ、画面上の周りのノックコンテンツの4枚を、それを実装しようとしたが、私は位置にそれらのすべてをやったことがなかったとき。
私が達成できる最も近いのはこれでしたが、そこにはハードコーディングされた制限の使用が嫌いです。私はそれがスーパーフレキシブルではないことに恐れています。
私はイメージの表示サイズを幾分制限しなければなりませんでしたが、囲まれたテキストブロックを望んでいました。ドロイドは自分でサイズを把握するのに十分なほどスマートです。
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dip"
android:text="text1" />
<ImageView
android:id="image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="text1"
android:layout_marginRight="7dip"
android:layout_marginTop="5dip"
android:adjustViewBounds="true"
android:maxHeight="150sp"
android:maxWidth="150sp"
android:src="srcFile" />
<TextView
android:layout_marginTop="5dip"
android:id="text2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignTop="image"
android:layout_below="text1"
android:layout_toRightOf="image"
android:text="text2" />
<TextView
android:id="text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="image"
android:layout_marginTop="10dip"
android:text="text3" />
だから私はあなたが私のアプローチを考えると何かがあるかどう私は改善できるだけでなく、どのように実際にそれを実装するために何を聞きたいのですが。
編集: だから、私はそれが十分に柔軟ではありません怖いので、私はこのコードの一部をドロップする可能性が解決策を見つけるしたいと思います:
android:maxHeight="150sp"
android:maxWidth="150sp"
。魅力のように働く!ありがとうございました。 – yoshi