Android 使用xml定义Drawable--第一篇:概述以和Shape Drawable示例

简介:

 A drawable resource is a general concept for a graphic that can be
   drawn to the screen and which you can retrieve with APIs such as
   getDrawable(int) or apply to another XML resource with attributes
   such as android:drawable and android:icon. There are several
   different types of drawables:



 - 图片资源是可以画在屏幕上图形。你可以通过API
   getDrawable(int)方法获取图片对象或者通过属性android:drawable、android:icon来使用他们。他们有不同的类型:

 - Bitmap File: A bitmap graphic file (.png, .jpg, or .gif). Creates a
   BitmapDrawable.

   Bitmap 文件: 一个图形文件(可以是png、jpg、gif文件、xml),使用BitmapDrawable来获取

 - Nine-Patch File: A PNG file with stretchable regions to allow image
   resizing based on content (.9.png). Creates a NinePatchDrawable.

   .9文件: png文件:可以定义伸缩改变图片大小的部位(后缀是.9.png),使用NinePatchDrawable获取

 - Layer List A Drawable that manages an array of other Drawables. These
   are drawn in array order, so the element with the largest index is be
   drawn on top. Creates a LayerDrawable.

   图层: 由多个图片组合成一个图片。他们按顺序被画出,所以最后一个图片被画在最顶层,使用LayerDrawable获取

 - State List An XML file that references different bitmap graphics for
   different states (for example, to use a different image when a button
   is pressed). Creates a StateListDrawable.

   状态资源: 一个Xml,用来在不同的状态下显示不同的Bitmap对象。

 - Level List An XML file that defines a drawable that manages a number
   of alternate Drawables, each assigned a maximum numerical value.
   Creates a LevelListDrawable.

 - Transition Drawable An XML file that defines a drawable that can
   cross-fade between two drawable resources. Creates 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值