在我的项目中,我在logcat
消息中收到以下消息,针对我应用的所有视图中的每个TextView
:
D/TextView: setTypeface with style : 0
我在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>
我也使用buildToolsVersion "26.0.1"
我还尝试使用Theme.AppCompat.Light.NoActionBar
作为父主题。邮件仍会被记录。
更新1
经过一些测试后,我发现只有*.Theme.AppCompat.Light.*
主题才会出现这种情况。
Theme.AppCompat.Light.NoActionBar
是最常用的,并且出现在每个材料设计教程中。
如何修复此问题?
更新2
注意:使用模拟器时,不会显示此消息。这很可能是设备问题。
答案 0 :(得分:25)
在logcat上,右键单击并选择&#34;折叠这样的行&#34;然后将该行向下编辑为&#34; TextView ...&#34; - 然后他们都消失了。
答案 1 :(得分:9)
这可能是三星特有的问题。您可能会尝试将AppCompatTextView
的所有实例替换为Logcat
,并查看这些警告是否会减少......而这只是一个疯狂的猜测。
建议将噪音静音;转到Edit Filter Configuration
&gt; ^(?!TextView)
然后包含packagename(以便类似于“仅显示选定的应用程序”选项) - 并使用独占正则表达式排除那个恼人的标记,类似:^(?!setTypeface\swith\sstyle\s:\s0)
或排除日志消息{{ 1}}。这应该减少垃圾邮件的数量。