Android Studio logger TextView TypeFace style 0

冷暖自知 提交于 2019-12-03 02:36:56

问题


In my project, I receive the following in a logcat message, for each TextView in all views of my app:

D/TextView: setTypeface with style : 0

The theme I used in styles.xml:

<style name="GreenTheme" parent="Base.Theme.AppCompat.Light">
    <item name="colorPrimary">@color/primaryGreen</item>
    <item name="colorPrimaryDark">@color/primaryDarkGreen</item>
    <item name="colorAccent">@color/accentGreen</item>

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

I also use buildToolsVersion "26.0.1"

I have also tried to use Theme.AppCompat.Light.NoActionBar as the parent theme. The messages still get logged.

UPDATE 1

After some tests i have found that this occurs only with *.Theme.AppCompat.Light.* themes.

Theme.AppCompat.Light.NoActionBar is most often used and comes in every tutorial for material design.

How can this issue be fixed?

UPDATE 2

Note: When using an emulator, this message does not show. It's most likely a device issue.


回答1:


On logcat, right click and select "Fold lines like this" then edit down that line to just the bit from "TextView..." - then they all disappear.




回答2:


this might be a Samsung specific issue. you probably could try to replace all instances of TextView with AppCompatTextView and see if those warnings get any less... while this is just a wild guess.

would suggest to mute the noise; goto Logcat > Edit Filter Configuration and then include the packagename (in order to resemble the option "Show only selected application") - and exclude that annoying tag with an exclusive regular expression, alike: ^(?!TextView) or exclude by log message ^(?!setTypeface\swith\sstyle\s:\s0).this should reduce the amount of log spam.



来源:https://stackoverflow.com/questions/46464361/android-studio-logger-textview-typeface-style-0

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