当前位置:   article > 正文

Android 在布局中tools使用

Android 在布局中tools使用

效果图
在这里插入图片描述
布局

 <TextView
        android:id="@+id/tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="你好,这是TextView"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        tools:visibility="visible" />

    <ImageView
        android:id="@+id/iv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/tv"
        tools:src="@mipmap/cn" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:background="@mipmap/cn"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/iv" />

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

在布局中因为各种原因,有时想让控件不显示,或者显示占位图的话,可以使用

tools:src="@mipmap/cn"
tools:visibility="visible"
tools:text=""
  • 1
  • 2
  • 3

等属性。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/943918
推荐阅读
相关标签
  

闽ICP备14008679号