-1

我的屏幕上有这样的布局在此处输入图像描述

代码是...

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical" 
android:scrollbarAlwaysDrawVerticalTrack="true"
android:background="@drawable/s21"
android:id="@+id/instructions_view" >

<TextView   
        android:id="@+id/main1name"
    android:layout_width="fill_parent"
    android:layout_height="30dp"
    android:layout_gravity="center"
    android:text="@string/main1name"
    android:textColor="@color/orange5" />

<LinearLayout 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"
    android:orientation="vertical" >
            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">

                <include android:id="@+id/imageView11"
                layout="@layout/test_button11"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"

               >
            </include>
            <include android:id="@+id/imageView12"
             layout="@layout/test_button12"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"

               >
            </include>

            </LinearLayout> 


            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">


            <include android:id="@+id/imageView13"
                layout="@layout/test_button13"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"

              >
            </include>
            <include android:id="@+id/imageView14"
             layout="@layout/test_button14"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"

              >
            </include>
            </LinearLayout> 


            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">


            <include android:id="@+id/imageView15"
                layout="@layout/test_button15"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"

               >
            </include>
            <include android:id="@+id/imageView16"
             layout="@layout/test_button16"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"

               >
            </include>
            </LinearLayout> 


            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">


            <include android:id="@+id/imageView17"
                layout="@layout/test_button17"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"

              >
            </include>
            <include android:id="@+id/imageView18"
             layout="@layout/test_button18"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"

        >
            </include>
            </LinearLayout> 


            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:orientation="horizontal">


            <include android:id="@+id/imageView19"
                layout="@layout/test_button19"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"
               >
            </include>
            <include android:id="@+id/imageView10"
             layout="@layout/test_button10"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:layout_weight="1"
               >
            </include>
            </LinearLayout> 
</LinearLayout> 

问题是 - 我不想在左、右、上和下按钮之间有间隔......我该怎么做?

4

1 回答 1

2

TableLayout您可以通过2 列和 6 行创建与布局相同的外观。只需填写TableLayout按钮。如果您想删除按钮之间的填充,您应该将自定义可绘制对象放入按钮的背景中(默认按钮背景默认具有填充和边距)。

于 2012-11-06T13:52:39.453 回答