【发布时间】:2017-04-27 06:24:17
【问题描述】:
VectorDrawable 指的是以下内容:
机器人:宽度
用于定义drawable的固有宽度。这 支持所有维度单位,通常用dp指定。
“内在”是什么意思?我认为 VectorDrawable 的点与大小无关。如果我不提供宽度,我的应用程序会崩溃。这个值有什么作用?我没有使用它,但无论如何我必须输入一个值。
【问题讨论】:
标签: android android-layout android-vectordrawable
VectorDrawable 指的是以下内容:
机器人:宽度
用于定义drawable的固有宽度。这 支持所有维度单位,通常用dp指定。
“内在”是什么意思?我认为 VectorDrawable 的点与大小无关。如果我不提供宽度,我的应用程序会崩溃。这个值有什么作用?我没有使用它,但无论如何我必须输入一个值。
【问题讨论】:
标签: android android-layout android-vectordrawable
android:width 和 android:height 指定的 VectorDrawable 的固有尺寸为可绘制对象提供了一个默认大小。
考虑以下几点:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/example_drawable"/>
这是什么尺寸?
ImageView 使用了wrap_content,所以它会包裹到可绘制对象的大小。如果 VectorDrawables 没有指定默认的高度和宽度,那么这个 ImageView 就没有意义了,它应该按照内容的大小换行,但是内容没有大小!
因此VectorDrawables 必须具有默认宽度和高度。您可以将它们缩放到您需要它们的大小,但如果在某些情况下没有从其他地方告诉他们应该是什么大小,他们需要知道该怎么做。
【讨论】: