大量的" W / TextPaint:FontMetrics:TextBound无效!顶部:-35"

时间:2015-01-23 22:00:26

标签: android android-layout

我每秒都会得到大量的警告(字面意思):

01-23 18:41:53.976  31015-31015/com.emmanuelmess.tacticaldefence W/TextPaint﹕ FontMetrics: TextBound invalid!!! top:-35 text:$100 - $0

(可能)重新创建的代码:

活动的XML

<[CustomView's path]
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:id="@+id/castle"
    android:layout_alignParentTop="true"
    android:layout_toLeftOf="@+id/defensive_sidebar_view"
    android:layout_toEndOf="@+id/offensive_sidebar_view"
    android:layout_alignParentBottom="true"
    android:layout_toRightOf="@+id/offensive_sidebar_view"
    android:layout_centerInParent="true"/>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/money_spent"
    android:layout_centerHorizontal="true"/>

活动课程

private static TextView money;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

    setContentView(R.layout.activity_game_castlemodify);

    money = (TextView) findViewById(R.id.money_spent);
}
public static TextView getMoney(){
    return money;
}

CustomView的课程

protected void onDraw(Canvas canvas) {
    TextView money = GameCastleModifyActivity.getMoney();
    money.setText( "$" + RenderGameCastleModifyActivity.money + " - $" + spent);
    money.setTextSize(42);
    if(setRedMoney) money.setTextColor(Color.RED);//Not needed to get warning
}

平台:

  • 摩托罗拉RAZR D1电视(Android 4.1.2 Jelly Bean)。

此UNANSWERED问题重复:FontMetrics: TextBound invalid ...

0 个答案:

没有答案