(can't find id reference) No resource matches the given name at

前端 未结 2 1453
轮回少年
轮回少年 2021-01-04 07:59

I have the following inside a relative layout.



        
相关标签:
2条回答
  • 2021-01-04 08:25

    The layout which you are trying to use as a reference should be defined before it is used as reference i.e. use as 'layout_toLeftOf'.

    It is like you have to declare a variable in java before using it. Declare then use it ...

    If you need to mention the id before its defined in the file, then you need to use @+id/textView1 instead of @id/textView1

    0 讨论(0)
  • 2021-01-04 08:30

    Using @+id is the right way to do it. @+id creates a new id but only if one with that name doesn't already exist.

    If you don't want to do that, for this particular simple case it would suffice to move the TextEdit below the Button.

    0 讨论(0)
提交回复
热议问题