转载自:http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0309/2567.html

安卓开发中,在写布局代码的时候,ide可以看到布局的预览效果。
android中xml tools属性详解
但是有些效果则必须在运行之后才能看见,比如这种情况:TextView在xml中没有设置任何字符,而是在activity中设置了text。因此为了在ide中预览效果,你必须在xml中为TextView控件设置android:text属性

<TextView
android:id="@+id/text_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="@style/TextAppearance.Title"
android:layout_margin="@dimen/main_margin"
android:text="I am a title" />

一般我们在这样做的时候都告诉自己,没关系,等写完代码我就把这些东西一并删了。但是你可能会忘,以至于在你的最终产品中也会有这样的代码。

相关文章:

  • 2022-12-23
  • 2022-01-04
  • 2021-10-07
  • 2021-11-08
  • 2022-01-01
  • 2021-05-31
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2021-05-02
  • 2022-12-23
  • 2021-07-15
  • 2021-10-29
相关资源
相似解决方案