Error with ConstraintLayout: No resource found that matches the given name

前端 未结 2 1237
闹比i
闹比i 2021-01-12 07:20

I learn how to use ConstraintLayout. And have problem.

My activity_test.xml




        
2条回答
  •  甜味超标
    2021-01-12 08:26

    You are trying to set a constraint based on a element before you define it. So to fix your problem you have two different ways:

    First solution: Replace your RelativeLayout(@+id/reserved_layout_search) constrains id values by:

    @id/btnScanQRCode -> @+id/btnScanQRCode
    @id/btnScanQRCode -> @+id/btnScanQRCode
    @id/tvReservedContInfo -> @+id/tvReservedContInfo
    

    Second solution: Declare your btnScanQRCode, btnScanQRCode and tvReservedContInfo widgets before your RelativeLayout on the XML file.

提交回复
热议问题