Beginner Android why is “id” is “Unknown member” with R.id?

后端 未结 5 1009
无人及你
无人及你 2021-01-16 09:54

I\'m sure this is something dead simple as it\'s my first android app with code (the hello world example I did was just assigning a value to a string in XML). My problem is

5条回答
  •  一向
    一向 (楼主)
    2021-01-16 10:13

    You must add id to a component in the XML file. Like this:

    android:id="@+id/buton1"
    

    Now can you click mainActivity.java and write code "R.id." you a see hint to write "buton1" and no error of "id"

提交回复
热议问题