-1

I need to set the image closer then the element in its left. The only way to do that is by editing the image taking all the margins off? what if i need it even closer?

Does the marginLeft accept a negative value?

This is how the ImageView is at xml file:

<ImageView
android:id="@+id/lineOneImageView"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerVertical="false"
android:layout_marginLeft="-6"
android:layout_toRightOf="@id/productNameTextView"
android:contentDescription="@string/text_placeholder"
android:scaleType="fitXY"
android:src="@drawable/img_i_black_normal" />

This is the error at this line: android:layout_marginLeft="-6"

Error: Integer types not allowed (at 'layout_marginLeft' with value '-6').
rafaeljuzo
  • 379
  • 2
  • 8

2 Answers2

3

You need to put the dp as an extension:

android:layout_marginLeft="-6dp"
rafaeljuzo
  • 379
  • 2
  • 8
Helder
  • 146
  • 2
2

You are getting the error because you missed the dimension unit dp. Android accepts negative margins if the layout is relative or linearlayout. See more here.

Community
  • 1
  • 1
Illegal Argument
  • 10,090
  • 2
  • 44
  • 61