我的屏幕
上有这样的布局代码是......
<?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>
问题是 - 我不想在左侧,右侧,顶部和底部的按钮之间有间隔......我怎么能这样做?
答案 0 :(得分:2)
您可以通过TableLayout
创建与2列和6行相同的布局。只需用按钮填充TableLayout
即可。如果你想删除按钮之间的填充,你应该将自定义drawable放入按钮的背景中(默认情况下,默认按钮背景有填充和边距)。