英文:
Android Studio EditText not Appearing in preview API 29
问题
你好,这是我的安卓工程项目。我创建了一个 EditText,在我的虚拟机上实际上可以正常工作,但在预览中显示不正确。我尝试将 SDK 版本从 29 降级到 28,但仍然没有解决任何问题。我不确定预览未能显示的原因。
英文:
Hello this is my android studio project. I have created a EditText which actually works normally on my virtual machine, but it doesn't appear properly in the preview. I had sdk level 29 and tried downgrading to 28 however that did not fix anything. I am unsure of the reason the preview is not appearing.
答案1
得分: 1
我不知道你为什么想要这样做(在EditText中设置文本)
顺便说一下,你可以使用这种方式在其中设置文本 https://stackoverflow.com/a/4594761/13295974
如果你想要在EditText中设置一个提示(这比在其中设置文本更好),你可以在xml中使用这个
android:hint="你的提示"
我建议你在这个地方使用提示
祝你好运
英文:
I don't know why you want do that (setting a text in an EditText)
btw you can use this way to set the text in it https://stackoverflow.com/a/4594761/13295974
if you want to set a hint in your EditText(it is better than setting a text in it) you can use this in xml
android:hint="your hint"
I suggest you to use hint in the place of text
Good Luck
答案2
得分: 0
刷新布局以重新加载所有元素。此外,最好将名称显示为{android:hint="name"},而不是默认的{android:text="Name"}。
英文:
Refresh the layout to reload all the elements. Also, it is better to show the name as
{android:hint="name"} instead of the default {android:text="Name"}.
答案3
得分: 0
我在Android Studio 4.2.1上遇到了相同的问题,只有EditText在预览中不可见。
我是这样解决的:
文件->设置->实验性->(启用实时布局检查器)
英文:
I had the same issue on Android studio 4.2.1, where only EditTexts were not visible on the preview.
I fixed it like so:
File->Settings->Experimental-> (Enable Live Layout Inspector)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论