Custom attribute not resolved inside styles and theme

孤人 提交于 2019-12-04 03:19:09

问题


I have android application with custom themes which was developed 2-3 year ago. I had this stylable in my attr.xml resouce file:

<declare-styleable name="EVETextViewPlus">
    <attr name="customFont" format="string" />
    <attr name="pageStripFont" format="string" />
</declare-styleable>

And I've used this inside my style_warm.xml resource file:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android"
    <style name="style_display_page_title_warm">
        <item name="my.app.package.:pageStripFont">fonts/b_titr.ttf</item>
        <item name="android:textSize">25dp</item>
        <item name="android:textColor">@color/colorDisplayPageTitle</item>
    </style>
....

When I'm going to sign my app, it checks for errors and prompts:

Cannot resolve symbol 'my.app.package:pageStripFont'

I should mention my.app.package is package name of my application defined in manifest.

This is piece of code which was working until 2 years ago and when I migrated my application to latest android SDK tools, Gradle and androidX, this error was eventually appeared and I don't know what's wrong.

I did see this answer, this one but I could not find the problem.

I also checked this and this which see more revelant but I did not realize how to fix the error.


回答1:


Replace this

<item name="my.app.package.:pageStripFont">fonts/b_titr.ttf</item>

with this

<item name="pageStripFont">fonts/b_titr.ttf</item>


来源:https://stackoverflow.com/questions/57115274/custom-attribute-not-resolved-inside-styles-and-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!