Custom attributes in styles.xml

后端 未结 6 928
野的像风
野的像风 2020-11-27 12:38

I have created a custom widget, and I\'m declaring it in layout.xml. I have also added some custom attributes in attr.xml. However, when trying to declare these attributes

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-27 12:49

    above answer is worked for me, I tried a litte change, I declare styleable for a class in resources element.

    
        
        
        
    
    

    in declare-styleable, the name attribute referenced a class name, so I had a view class call "com.my.package.name.VerticalView", it represented this declare must be use in VerticalView or subclasses of VerticalView. so we can declare style like this :

    
        
    
    

    that's why we didn't declare namespace at resources element, it still work.

提交回复
热议问题