2014-09-27 32 views
0

IMAGEAndroid的用户界面默认保证金删除

我想从我的布局中删除这些汽车的利润,

这里是我的Layout.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:weightSum="3" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
tools:context="com.shifz.bardofavon.MainActivity" > 

<LinearLayout 
android:weightSum="3" 
android:layout_weight="1" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 

    <LinearLayout 
    android:weightSum="2" 
    android:orientation="vertical" 
    android:layout_weight="2" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 

      <Button 
       android:layout_weight="1" 
       android:id="@+id/b1" 
       android:layout_height="match_parent" 
       android:layout_width="match_parent" 
       android:text="Quotes" 
       /> 
      <Button 
       android:layout_weight="1" 
       android:id="@+id/b2" 
       android:layout_height="match_parent" 
       android:layout_width="match_parent" 
       android:text="Quotes" 
       /> 
    </LinearLayout> 

    <LinearLayout 
    android:weightSum="1" 
    android:layout_weight="1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 
      <Button 
       android:layout_weight="1" 
       android:id="@+id/b3" 
       android:layout_height="match_parent" 
       android:layout_width="match_parent" 
       android:text="MostWeight" 
       /> 
    </LinearLayout> 

</LinearLayout> 



<LinearLayout 
android:weightSum="3" 
android:layout_weight="2" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
> 

    <Button 
     android:layout_weight="1" 
     android:id="@+id/b4" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="Biography" 
     /> 
    <Button 
     android:layout_weight="2" 
     android:id="@+id/b5" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:text="Biography" 
     /> 


</LinearLayout>  

+0

我认为按钮将采取一些默认的边距,请尝试用LinearLayout替换Button并检查是否显示额外的空间。 – 2014-09-27 04:28:25

+0

正确使用你的'weight'属性。 – Piyush 2014-09-27 04:34:07

回答

0

您正在使用的重量财产所以对于Button它将需要一些默认保证金。为了避免这种情况,有两种方法。

1)使Button的背景变为Null。像,

android:background="@null" 

2)应用一些背景颜色到您的按钮。

android:background="@color/red" 

这两个选项可以避免你的问题。