Skip to content Skip to sidebar Skip to footer

Why Would Eclipse Tell Me There Is No Attribute "margin" For A Linearlayout?

I'm getting an error when I try and build my android project: No resource identifier found for attribute 'margin' in package 'android' And it references this layout as the culpri

Solution 1:

The correct attribute name for declaring a 5p margin in every direction is:

android:layout_margin="5dp"

Note the layout_ prefix. You'll want to remove the line that says android:margin="5dp", which is what makes Eclipse complain.

The full set of valid margin attributes includes:

  • layout_margin
  • layout_marginBottom
  • layout_marginEnd
  • layout_marginLeft
  • layout_marginRight
  • layout_marginStart
  • layout_marginTop

Post a Comment for "Why Would Eclipse Tell Me There Is No Attribute "margin" For A Linearlayout?"