简体   繁体   中英

Remove Extra Space between Views

在此处输入图像描述

I'm building a simple calculator app and i cannot get ride of extra grey lines next to an ImageButton

Button Code

<Button
  android:id="@+id/button_clear"
  android:layout_width="0dp"
  android:layout_height="match_parent"
  android:layout_weight="1"
  android:background="@color/white"
  android:text="AC"
  android:textColor="@color/indigo"
  android:textSize="18sp" />

ImageButton Code

<ImageButton
  android:id="@+id/button_back"
  android:layout_width="0dp"
  android:layout_height="match_parent"
  android:layout_weight="1"
  android:src="@drawable/backspace"
  android:background="@color/white"/>

As you can see, the buttons are perfect but the ImageButton have grey lines next to them. I tried settings the Parent background to 'White' and setting the ImageButton background to '@null' too I tried an Imageview and the Problem still exists i tried setting the image as background to the button and it still exists i even tried setting negative margin towards left and right and the problem still exists

Can someone help me out please?

I have a suggestion: Use a button to display the ⌫ symbol. For information on how to get the desired results visit: How to make ⌫ symbol backward-compatible in Android Studio?

Add this in your ImageButtons

style="?android:attr/borderlessButtonStyle"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM