android中的tools:text和android:text之间有什么区别 [英] What is difference between tools:text and android:text in android

查看:1537
本文介绍了android中的tools:text和android:text之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我才知道我们可以使用tools:text ="toolsText"来设置文本. 在此之前,我使用的是android:text ="androidText".

i just came to know that we can set the text by using tools:text="toolsText". before this i was using android:text="androidText".

请告诉我 1.这两个功能有什么区别 2.哪个最好用 3. ui渲染期间有什么作用

Please tell me 1.what are differences between these two feature 2.which one is best to use 3.What are there effect during ui rendering

推荐答案

  1. tools:text="toolsText"仅用于Android Studio布局预览,在运行应用程序时不显示文本.完美的是,当您不想进行文本计算直到完成一些计算,然后才在活动中以编程方式自行设置文本时,还想在Android Studio中编写代码时看到预览布局,它看起来像当您运行应用程序时.
  2. android:text="androidText"用于将文本设置为布局元素,textView或按钮等.
  1. tools:text="toolsText" is used only for Android Studio layout preview, it not shows text when you run an app. It's perfect, when you don't want to set a text until you do some calculations, and only then set text programmatically by yourself in activity, also you want to see preview layout when you write code in Android Studio, how it will look like when you run an app.
  2. android:text="androidText" is used to set text to a a layout element, textView or a button etc.

这篇关于android中的tools:text和android:text之间有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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