Android-drawable资源-InsetDrawable
来源:互联网 发布:四大名捕 知乎 编辑:程序博客网 时间:2024/05/30 05:40
InsetDrawable对应res/drawable/下的inset标签,他表示一个drawable资源以制定内边距的方式内嵌入另一个drawable资源文件。
不同于drawable的padding属性,padding制定drawable内图与自身的内边距。当View需要的背景比边框小的时候比较适合使用InsetDrawable。
属性解析:(res/drawable/inset.xml)
<?xml version="1.0" encoding="utf-8"?><inset xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/beauty" //指定drawable资源 android:insetLeft="20dp" //dimension 与左边的距离
android:insetRight="20dp" //dimension 与右边的距离 android:insetTop="20dp" //dimension 与顶部的距离 android:insetBottom="20dp" > //dimension 与底部的距离 </inset>
xml中的引用:
<Button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello" android:background="@drawable/inset"/>
纯代码实现:
InsetDrawable insetDrawable=new InsetDrawable(getResources().getDrawable(R.drawable.aa), 20, 20, 20, 20);Button btn=(Button) findViewById(R.id.btn);btn.setBackground(insetDrawable);
0 0
- Android-drawable资源-InsetDrawable
- Android中的Drawable资源—— InsetDrawable
- android drawable InsetDrawable
- Android Drawable之InsetDrawable
- Android Drawable之InsetDrawable
- Android Drawable Resource学习(八)、InsetDrawable
- Android Drawable Resource学习(八)、InsetDrawable
- Android Drawable Resource学习(八)、InsetDrawable
- Android Drawable Resource学习(八)、InsetDrawable
- Drawable学习之-----InsetDrawable
- Android InsetDrawable
- Drawable子类——InsetDrawable
- InsetDrawable 内嵌式Drawable使用详解
- android Drawable资源
- Android中的Drawable资源
- android Drawable资源文件
- android之drawable资源
- Android中的Drawable资源
- oracle问题解决记录贴
- Maven导出Project依赖的jar包
- Wireshark过滤规则
- 简单的android客户端servlet服务端的交互
- 正则表达式的简单梳理
- Android-drawable资源-InsetDrawable
- leetcode | 3Sum
- Java接口
- 《c++ primer》4 指针和const限定符
- nunit用法
- java中System.getProperty()方法详解
- 用户第一次拖动widget到桌面上,不用授权提示,直接安装
- QT学习(1)Windows环境下的串口编写
- Java Collection框架简略