Declaring a custom android UI element using XML

前端 未结 6 867
渐次进展
渐次进展 2020-11-22 03:43

How do I declare an Android UI element using XML?

6条回答
  •  旧巷少年郎
    2020-11-22 04:02

    Great reference. Thanks! An addition to it:

    If you happen to have a library project included which has declared custom attributes for a custom view, you have to declare your project namespace, not the library one's. Eg:

    Given that the library has the package "com.example.library.customview" and the working project has the package "com.example.customview", then:

    Will not work (shows the error " error: No resource identifier found for attribute 'newAttr' in package 'com.example.library.customview'" ):

    
    

    Will work:

    
    

提交回复
热议问题