0

TextViewをImageButtonの左側に設定しようとしていますが、このオプションが見つからないようです。

android:layout_alignLeftのようなものを使用することを期待していましたが、このオプションがありません。

問題をグーグルで検索しようとしましたが、相対的な結果が見つかりませんでした。

ここに画像の説明を入力してください

それがないと、TextViewがImageButtonとオーバーラップするので、避けたいと思います。

アップデート

完全なxmlコードは複雑すぎますが、ここにその重要な部分があります。

<FrameLayout
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_alignParentLeft="true"
        android:background="@color/white"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        android:layout_toLeftOf="@+id/frameLayoutBalanceClosed">
    <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/button_edit_nickname"
            android:id="@+id/card_closed_control_editNickname" />
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/card_closed_description_nickname"
            android:layout_margin="8dp" android:layout_gravity="left"/>
</FrameLayout>
4

1 に答える 1

1

必要なのはRelativeLayoutだと思います。ImageViewの左側にあるTextViewをその仕様で指定できます。コードは次のようになります。

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

    <TextView
        android:id="@+id/text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toLeftOf="@+id/imagebutton1" />

    <ImageButton
        android:id="@+id/imagebutton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RelativeLayout>

FrameLayoutが機能しない理由は、アイテムを互いにオーバーレイすることが目的であるためですが、これはまったく機能しません。

それがあなたが探しているものでない場合は、アイテムが列に配置されているTableLayoutを使用することもできます。

于 2013-01-01T02:39:44.700 に答える