0

在我的 android 应用程序中,我想设计像打击这样的布局

家

我有四个单独的图像,如下所示

在此处输入图像描述在此处输入图像描述

请任何人帮助我如何设计此布局。提前致谢

4

3 回答 3

1

You can try this..

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

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

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

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/image1" />

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/image2" />
        </LinearLayout>

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

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/image4" />

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/image3" />
        </LinearLayout>
    </LinearLayout>

</RelativeLayout>
于 2013-10-07T06:52:49.897 回答
0
// try this
<?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:padding="5dp"
              android:orientation="vertical">

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="0.25">
        <LinearLayout
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="match_parent">

            <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="fitXY"
                    android:adjustViewBounds="true"
                    android:src="@drawable/ic_launcher"/>
        </LinearLayout>
        <LinearLayout
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="match_parent">

            <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="fitXY"
                    android:adjustViewBounds="true"
                    android:src="@drawable/ic_launcher"/>
        </LinearLayout>

    </LinearLayout>

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="0.75">
        <LinearLayout
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="match_parent">

            <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="fitXY"
                    android:adjustViewBounds="true"
                    android:src="@drawable/ic_launcher"/>
        </LinearLayout>
        <LinearLayout
                android:layout_width="0dp"
                android:layout_weight="1"
                android:layout_height="match_parent">

            <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="fitXY"
                    android:adjustViewBounds="true"
                    android:src="@drawable/ic_launcher"/>
        </LinearLayout>
    </LinearLayout>
</LinearLayout>
于 2013-10-07T06:38:20.110 回答
0

要实现这一点,您需要有 5 组图像。一个是默认的,其他四个就像在此处输入图像描述

所以onclick图像你需要用动画来切换图像。

于 2013-10-07T07:19:36.393 回答