Android Studio-TextView显示在预览上,但不显示模拟器/设备 [英] Android studio - TextView showing on preview but not emulator/device

查看:198
本文介绍了Android Studio-TextView显示在预览上,但不显示模拟器/设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始写《面向程序员的Android 6:一种应用程序驱动的方法》一书,遇到了一个问题.我遵循其中一个应用程序的分步方法,但遇到了一个令人沮丧的错误,我无法修复.

I started the "Android 6 for Programmers: An App-Driven Approach" book and ran into a problem. I was following the step-by-step approach for one of the apps and got a pretty frustrating error that I cannot fix.

我添加了文本和图像视图,并在预览"部分以应有的方式显示了这些视图,但是当我在模拟器或实际设备上运行应用程序时,文本似乎丢失了.为了更加清晰,我将在下面附加照片.

I've added a text and image views and on the Preview section they are shown as they should be but when I run the app on the emulator or on an actual device the text seem to be missing. I am going to attach photos below for more clarity.

自定义颜色是材料蓝色500"(#2196F3).尝试将其更改为另一个,但问题似乎并未受到影响.文字大小为40sp(在600x600的设备上为80sp).

The custom colour is Material Blue 500 (#2196F3). Tried changing it to another but the problem doesn't seem to be affected by it. The text size is 40sp (80sp on a > 600x600 device).

推荐答案

您需要将 tools:text 更改为 android:text .使用工具属性,您只能在设计时查看预览.

You need to change tools:text to android:text. Using tools attribute you can only see preview in design time.

这篇关于Android Studio-TextView显示在预览上,但不显示模拟器/设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆