Android中的ImageView内容是否有工具属性?

Ely*_*Ely 6 android android-layout

我找不到工具属性来在Android的布局中设置示例图像.我的假设是目前没有这样的事情,至少没有直接的支持.

但我想知道我是否只是搜索不好或是否有解决方法.

如何使用工具在Android设计时定义图像占位符?


TextView 的工具属性示例(即工具:文本的文本属性):

<TextView
    android:id="@+id/tv_vote_average"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="16sp"
    android:textStyle="bold"
    tools:text="8.4/10"/>
Run Code Online (Sandbox Code Playgroud)

tyn*_*ynn 12

这很简单TextView.只是tools:src用来设置图像.

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    tools:src="@drawable/placeholder" />
Run Code Online (Sandbox Code Playgroud)


waj*_*jih 10

将此用于随机真实样本图像:

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleType="centerCrop"
    tools:src="@tools:sample/backgrounds/scenic" />
Run Code Online (Sandbox Code Playgroud)