Android XML: RuntimeException: Failed to resolve attribute at index 6

后端 未结 10 1914
梦如初夏
梦如初夏 2020-12-01 23:44

Hello dear stackoverflower,

In my project, i am using the new \"android design library\". The problem is, that there is a runtime exception which says(Im trying to c

10条回答
  •  青春惊慌失措
    2020-12-02 00:08

    I was using a custom attribute in attrs.xml and a customview. I ran into this problem as I didn't specify theme: attribute in the custom view. Quick look of how the files look

    attrs.xml

    
        
        ...
    
    

    customview.xml

    
    

    In my styles.xml, I extended my style to use AppTheme

    
        
     ...
        
    ...
    
    

    The culprit here was custom attribute ?textColorPrimary. As I didn't define AppTheme in the customview, it wasn't able to determine how to load textColorPrimary. By android:theme="@style/AppTheme", this got fixed))

提交回复
热议问题