Inset Drawable
A drawable defined in XML that insets another drawable by a specified distance.This is useful when a View needs a background that is smaller than the View's actual bounds.
-
FILE LOCATION:
-
res/drawable/filename.xml
The filename is used as the resource ID.
COMPILED RESOURCE DATATYPE:
-
Resource pointer to a
InsetDrawable.
RESOURCE REFERENCE:
-
In Java:
R.drawable.filename
In XML:@[package:]drawable/filename
SYNTAX:
-
<?xml version="1.0" encoding="utf-8"?> <inset xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/drawable_resource" android:insetTop="dimension" android:insetRight="dimension" android:insetBottom="dimension" android:insetLeft="dimension" />
-
ELEMENTS:
- EXAMPLE:
-
<?xml version="1.0" encoding="utf-8"?> <inset xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/background" android:insetTop="10dp" android:insetLeft="10dp" />
SEE ALSO:
-
InsetDrawable详解
本文介绍了一种特殊的Drawable资源——InsetDrawable,它可以将其他Drawable资源按指定距离内嵌,适用于需要背景比视图实际边界小的场景。文章详细解释了InsetDrawable的XML定义方式及其属性。
366

被折叠的 条评论
为什么被折叠?



