-1

如何创建像这样的图像 http://imgur.com/S6XrFMD所有三个图像在相同布局和所有三个文本视图在相同布局?我该怎么办?请帮助我如何制作如下图所示的屏幕?请帮帮我,谢谢

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dp"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/img1"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:background="@drawable/imagebgborder"
            android:clickable="true"
            android:contentDescription="@null"
            android:onClick="imageClick"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/txt1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="15dp"
            android:contentDescription="@null"
            android:gravity="center"
            android:text="@string/hello_world"
            android:textStyle="bold" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="5dp"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/img2"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:background="@drawable/imagebgborder"
            android:contentDescription="@null"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/txt2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="15dp"
            android:contentDescription="@null"
            android:gravity="center"
            android:text="@string/hello_world"
            android:textStyle="bold" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/img3"
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:background="@drawable/imagebgborder"
            android:contentDescription="@null"
            android:src="@drawable/ic_launcher" />

        <TextView
            android:id="@+id/txt3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="15dp"
            android:contentDescription="@null"
            android:gravity="center"
            android:text="@string/hello_world"
            android:textStyle="bold" />
    </LinearLayout>

</LinearLayout>
4

2 回答 2

1

这是您发布的完全一致的代码:

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="3"
            android:orientation="horizontal" >

            <LinearLayout
                android:id="@+id/s"
                android:layout_width="0px"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/img1"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:background="@drawable/imagebgborder"
                    android:clickable="true"
                    android:contentDescription="@null"
                    android:onClick="imageClick"
                    android:src="@drawable/ic_launcher" />

            </LinearLayout>


            <LinearLayout
                android:id="@+id/s2"
                android:layout_width="0px"
                android:layout_weight="1"
                android:gravity="center"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/img2"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:background="@drawable/imagebgborder"
                    android:contentDescription="@null"
                    android:src="@drawable/ic_launcher" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/s3"
                android:layout_width="0px"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="vertical" >

                <ImageView
                    android:id="@+id/img3"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:background="@drawable/imagebgborder"
                    android:contentDescription="@null"
                    android:src="@drawable/ic_launcher" />

            </LinearLayout>

        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:weightSum="3"
            android:orientation="horizontal" >

            <LinearLayout
                android:id="@+id/s4"
                android:layout_width="0px"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txt1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="15dp"
                    android:contentDescription="@null"
                    android:gravity="center"
                    android:text="@string/hello_world"
                    android:textStyle="bold" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/s5"
                android:layout_width="0px"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txt2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="15dp"
                    android:contentDescription="@null"
                    android:gravity="center"
                    android:text="@string/hello_world"
                    android:textStyle="bold" />

            </LinearLayout>

            <LinearLayout
                android:id="@+id/s6"
                android:layout_width="0px"
                android:layout_weight="1"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/txt3"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="15dp"
                    android:contentDescription="@null"
                    android:gravity="center"
                    android:text="@string/hello_world"
                    android:textStyle="bold" />

            </LinearLayout>

        </LinearLayout>

    </LinearLayout>
于 2013-07-30T08:00:44.307 回答
1
<LinearLayout

android:layout_width="match_parent"
android:layout_height="match_parent"


 android:orientation="vertical" >





 <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
 android:layout_marginRight="5dp"
  android:orientation="horizontal" >

<ImageView
     android:id="@+id/img1"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:contentDescription="@null"

    android:clickable="true"  
   android:onClick="imageClick" 

    android:background="@drawable/imagebgborder"
    android:src="@drawable/ic_launcher" />
<ImageView
     android:id="@+id/img2"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:contentDescription="@null"
    android:background="@drawable/imagebgborder"
    android:src="@drawable/ic_launcher" />
<ImageView
     android:id="@+id/img3"

    android:layout_width="100dp"
    android:layout_height="100dp"
    android:contentDescription="@null"
    android:background="@drawable/imagebgborder"
    android:src="@drawable/ic_launcher" />


   </LinearLayout>

 <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:orientation="horizontal" >
<TextView
     android:id="@+id/txt1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="15dp"
    android:textStyle="bold"
    android:gravity="center"
    android:contentDescription="@null"
    android:text="@string/hello_world" />



<TextView
     android:id="@+id/txt2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
     android:textStyle="bold"
    android:layout_marginTop="15dp"
    android:contentDescription="@null"
    android:text="@string/hello_world" />

<TextView
     android:id="@+id/txt3"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="15dp"
    android:gravity="center"
     android:textStyle="bold"
    android:contentDescription="@null"
    android:text="@string/hello_world" />
  </LinearLayout>

 </LinearLayout>
于 2013-07-30T07:41:16.730 回答