0

TextViewの隣に権利を持たせようとしていImageButtonます。ただし、TextViewうまく整列していません。と同じトップ位置から開始したいImageButton

これが今の様子です:

ここに画像の説明を入力

これが私のレイアウトです:

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="15dp"
    android:layout_marginBottom="10dp"
    android:layout_marginLeft="10dp"
    android:orientation="horizontal">

    <ImageButton
        android:id="@+id/myimage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:src="@drawable/myimage"/>

    <TextView
        android:id="@+id/mytexview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="14dp"
        android:text="My Text"
        android:textStyle="bold"
        android:layout_marginLeft="5dp"
        android:textColor="#DF533B"
        />

</LinearLayout>
4

5 に答える 5

2

タグandroid:gravity="top"内の要素を表示するには、このプロパティを設定します。TextView

これがうまくいくことを願っています。

于 2014-05-21T12:12:00.533 に答える
1

それを試してください:

<TextView
        android:id="@+id/mytexview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="14dp"
        android:drawableLeft="@drawable/myimage"
        android:text="My Text"
        android:textStyle="bold"
        android:gravity="center_vertical"
        android:layout_marginLeft="5dp"
        android:textColor="#DF533B"/>
于 2014-05-21T12:13:13.647 に答える
0

試す、

android:gravity="top"テキストビューで

于 2014-05-21T12:07:02.757 に答える