【发布时间】:2017-05-29 19:12:59
【问题描述】:
如下图所示,按钮和文本视图之间存在间隙。我需要删除这个空间,或者我需要将其颜色更改为原色。这是我的代码和快照
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="5">
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="2"
android:orientation="vertical"
android:background="@color/colorPrimary"
android:paddingRight="2dp"
android:paddingLeft="2dp"
android:layout_height="170dp">
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/splash"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/logo1"
android:layout_width="fill_parent"
android:layout_height="100sp"
android:orientation="horizontal"
android:layout_weight="1"
android:padding="2dp"
android:background="@color/colorPrimary">
<LinearLayout
android:id="@+id/mobileRelView"
android:orientation="vertical"
android:weightSum="2"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="1dp"
android:onClick="goToMobileForm"
android:layout_weight="0.25">
<ImageView
android:padding="7dp"
android:id="@+id/mobile_Image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="1dp"
android:clickable="false"
android:layout_weight="0.7"
android:scaleType="fitCenter"
android:src="@drawable/smartphone"/>
<Button
android:id="@+id/mobile_button"
android:layout_width="match_parent"
android:layout_weight="1.3"
android:clickable="false"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:text="Mobile"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="@dimen/mainbuttontext"/>
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:onClick="goToDesktopForm"
android:weightSum="2"
android:clickable="true"
android:paddingLeft="2dp"
android:paddingRight="1dp"
android:layout_weight="0.25">
<ImageView
android:id="@+id/desktop_Image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:clickable="false"
android:scaleType="fitCenter"
android:src="@drawable/compuericon"/>
<Button
android:text="Desktop"
android:textAllCaps="false"
android:layout_width="match_parent"
android:clickable="false"
android:layout_height="match_parent"
android:id="@+id/desktop_button"
android:background="@color/colorPrimary"
android:textSize="@dimen/mainbuttontext"
android:textColor="#000000"
android:layout_weight="1.3" />
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:layout_width="match_parent"
android:paddingLeft="1dp"
android:orientation="vertical"
android:onClick="goToLaptopForm"
android:weightSum="2"
android:layout_height="match_parent"
android:layout_weight="0.25">
<ImageView
android:id="@+id/laptop_Image"
android:layout_width="match_parent"
android:layout_weight="0.7"
android:clickable="false"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="@drawable/laptop" />
<Button
android:text="Laptop"
android:textAllCaps="false"
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/laptop_button"
android:textSize="@dimen/mainbuttontext"
android:background="@color/colorPrimary"
android:textColorHint="#ffffff"
android:layout_weight="1.3"
android:textColor="#000000"/>
<View
android:layout_width="70dp"
android:layout_height="2dp"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:background="#424242" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/logobutton1"
android:layout_width="fill_parent"
android:layout_height="100sp"
android:orientation="horizontal"
android:layout_weight="1"
android:padding="2dp"
android:background="@color/colorPrimary">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="2dp"
android:paddingLeft="1dp"
android:onClick="gotToOthersForm"
android:weightSum="2"
android:layout_weight="0.25">
<ImageView
android:id="@+id/homeappliances_Image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.7"
android:padding="7dp"
android:clickable="false"
android:scaleType="fitCenter"
android:src="@drawable/washingmachine"/>
<Button
android:text="Home Appliance"
android:textAllCaps="false"
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/homeappliances_button"
android:background="@color/colorPrimary"
android:textSize="@dimen/mainbuttontext"
android:layout_weight="1.3"
android:textColor="#000000"/>
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingRight="1dp"
android:weightSum="2"
android:onClick="goToDesktopForm"
android:layout_weight="0.25">
<ImageView
android:layout_weight="0.7"
android:clickable="false"
android:id="@+id/cleaning_Image"
android:padding="7dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="@drawable/caricon" />
<Button
android:text="Automobile"
android:textAllCaps="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cleaning_button"
android:background="@color/colorPrimary"
android:textSize="@dimen/mainbuttontext"
android:layout_weight="1.3"
android:clickable="false"
android:textColor="#000000" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#424242" />
<LinearLayout
android:orientation="vertical"
android:weightSum="2"
android:onClick="gotToOthersForm"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="1dp"
android:layout_weight="0.25">
<ImageView
android:layout_weight="0.7"
android:id="@+id/othrs_Image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:padding="7dp"
android:clickable="false"
android:src="@drawable/othersicon" />
<Button
android:text="Others"
android:textAllCaps="false"
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/others_button"
android:background="@color/colorPrimary"
android:textSize="@dimen/mainbuttontext"
android:layout_weight="1.3"
android:textColor="#000000"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_height="150sp">
<!--<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#6A1B9A"
android:textStyle="bold"
android:background="#ffb300"
android:textSize="15sp"
android:text="Why eFix ?" />
-->
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="2dp"
android:scaleType="centerCrop"
app:srcCompat="@drawable/abca" />
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
【问题讨论】:
标签: java android xml android-layout