Why would Eclipse tell me there is no attribute “margin” for a LinearLayout?

前端 未结 1 1831
梦谈多话
梦谈多话 2020-12-07 03:34

I\'m getting an error when I try and build my android project:

No resource identifier found for attribute \'margin\' in package \'android\'

相关标签:
1条回答
  • 2020-12-07 04:18

    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
    0 讨论(0)
提交回复
热议问题