1

XMLでそれを行う方法をまだ見つけていません。テキストビューを左に配置し、イメージビューを右に配置する必要があります。コードは次のとおりです。

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

<TableRow
    android:id="@+id/tr1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <TextView
        android:layout_height="wrap_content"
        android:text="Vibration"
        android:layout_width="wrap_content" />


    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:src="@drawable/ic_launcher" />


</TableRow>
</TableLayout>

それを行う方法はありますか?

4

4 に答える 4

1

TableRow次のように変更してみてください。

<TableRow
    android:id="@+id/tr1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >
    <TextView
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:text="Vibration"
        android:gravity="left" />
    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:gravity="right"
        android:src="@drawable/ic_launcher" />
</TableRow>
于 2012-08-29T20:13:02.530 に答える
1

私はそれを使用してそれを達成しました、

android:gravity="left"
android:paddingLeft="50dp"

それが役立つことを願っています!

于 2013-05-28T02:12:51.033 に答える
0

それはすべきではありません:

android:layout_alignParentLeft="true" /// テキストボックス用

android:layout_alignParentRight="true" /// imageview の場合。これを試して

于 2012-08-29T20:14:18.507 に答える