我正在使用自定义字体,它在新的Android版本上完美显示(在API 17(华硕标签),18(戴尔标签),19(Nex4) - 设备上测试).但是,旧版本的相同字体看起来褪色(可能是扭曲的?) - API 8(SE X10i),10(LG P500H).
这是一个比较,以防我的解释没有意义:
在nex4上:

在x10i上:

我使用Typeface.BOLD的自定义字体:
tvTitle.setTypeface(titleAndBodyFont, Typeface.BOLD);
Run Code Online (Sandbox Code Playgroud)
和身体("看起来*"部分):
tvBody.setTypeface(titleAndBodyFont);
Run Code Online (Sandbox Code Playgroud)
标题的XML声明:
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_title_side"
android:layout_marginRight="@dimen/margin_title_side"
android:layout_marginTop="@dimen/margin_title_top"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/constant_color"
android:textSize="@dimen/text_size_title" />
Run Code Online (Sandbox Code Playgroud)
tvBody 以类似的方式宣布.
这是一个已知的错误?如果是这样,有人可以帮我找到错误报告吗?这将有助于了解这个版本的修复版本.如果没有,我会很感激解决方案.
感谢大家.
我有以下if-else块:
boolean condA = false, condB = true;
if (!condA) {
// do WORK_C
} else {
if (condB) {
// do WORK_C
}
}
Run Code Online (Sandbox Code Playgroud)
在写这篇文章时,我意识到我在两个条件匹配中都做了同样的工作.我想知道这是否可以进一步压缩.
如果需要,我愿意提供更多信息/背景.