0

これが私のxmlです。グラフィックレイアウトの画像間に隙間があり、避けたいです。5つの画像が1つの画像のように見えるように、すべての画像を互いに整列させたい.

<LinearLayout
    android:id="@+id/linearInteractTab"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"

    android:layout_centerHorizontal="true"
    android:weightSum="5"
    android:layout_margin="5dp" >

    <ImageView
        android:id="@+id/imgCall"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:src="@drawable/call" />

    <ImageView
        android:id="@+id/imgMsg"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/mail" />

    <ImageView
        android:id="@+id/imgComment"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/chat" />

    <ImageView
        android:id="@+id/imgDir"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/direction" />

    <ImageView
        android:id="@+id/imgAppt"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:src="@drawable/calender" />
</LinearLayout>
4

3 に答える 3

0
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_margin="5dp"
    android:weightSum="5" >

    <ImageView
    android:id="@+id/imgComment"
    android:layout_width="fill_parent"
    android:layout_marginLeft="10dp"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher" />
    <ImageView
    android:id="@+id/imgComment"
    android:layout_width="fill_parent"
    android:layout_marginLeft="20dp"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher" />

    <ImageView
    android:id="@+id/imgComment"
    android:layout_width="fill_parent"
    android:layout_marginLeft="30dp"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_launcher" />

   </FrameLayout>

フレームレイアウトを使用して、4つの画像を重ねて配置しました。marginLeft画像が実際にそこにあることを示すために私はちょうど与えました。

于 2012-12-13T04:37:45.267 に答える
0

設定

layout_width="0dp"

すべての画像と削除

android:weightSum="5"

すべての画像が同じサイズの場合、これは正しいです:

android:layout_height="wrap_content"

サイズが異なる場合、それらを正しく配置するのは難しくなりますが、固定サイズを設定すると役立つ場合があります。

于 2012-12-12T13:35:06.070 に答える
0

android:layout_margin="5dp"親線形レイアウトからこの行を削除してみてください

于 2012-12-12T13:05:48.467 に答える