【问题标题】:Android; TextView does not appear on screen, while my game runs安卓;当我的游戏运行时,TextView 没有出现在屏幕上
【发布时间】:2015-03-02 10:10:05
【问题描述】:

看起来实际的游戏在文本视图“顶部”...

这是布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"

tools:context=".MyActivity">


<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="Large Text"
    android:id="@+id/textView"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true" />

我在 Draw 上绘制其他所有内容

【问题讨论】:

  • I draw everything else onDraw 为什么不在onDraw() 方法中也画出文字呢?
  • 没有足够的信息来帮助找到解决方案。

标签: java android layout textview


【解决方案1】:

您可以使用 canvas.drawText() 并删除 TextView。我认为这更容易。看这个例子:Android Canvas.drawText

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-08
    • 1970-01-01
    • 2014-04-19
    • 1970-01-01
    相关资源
    最近更新 更多