NiewPatchDrawable

在使用AS的时候要注意以下几点:

  • 1.点9图不能放在mipmap目录下,而需要放在drawable目录下!
  • 2.AS中的.9图,必须要有黑线,不然编译都不会通过

xml定义NinePatchDrawable:

<!--pic9.xml-->  
<!--参数依次为:引用的.9图片,是否对位图进行抖动处理-->  
<?xml version="1.0" encoding="utf-8"?>  
<nine-patch  
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:src="@drawable/dule_pic"  
    android:dither="true"/>  

使用Bitmap包装.9图片:

<!--pic9.xml-->  
<!--参数依次为:引用的.9图片,是否对位图进行抖动处理-->  
<?xml version="1.0" encoding="utf-8"?>  
<bitmap  
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:src="@drawable/dule_pic"  
    android:dither="true"/>

 

posted on 2018-12-24 15:52  LoaderMan  阅读(150)  评论(0编辑  收藏  举报

导航