矢量图学习(二)
来源:互联网 发布:数据分析员培训 编辑:程序博客网 时间:2024/05/18 13:28
在textview旁边放置vectorDrawable(左,上,右,下)
//测试动态创建TextView直接设置VectorDrawableTextView textView = new TextView(this);textView.setText("我是代码创建的TextView");textView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.love_drawable) ,null,null,null);mRootView.addView(textView);
修改图标颜色
1.在ector的xml中改fillcolor,则这个图标就不好复用了
2.可以用代码在合适的位置设置:
VectorDrawableCompat a = VectorDrawableCompat.create(getResources(), R.drawable.icon_shopping, getResources().newTheme()); a.setTint(Color.RED); //设置单一的颜色 a.setTintList(ColorStateList.valueOf(Color.RED));//设置状态性的,比如点击一个颜色,未点击一个颜色
DrawableCompat.setTint(a,Color.RED); //用这个v4提供的也可,这个适用于任意的drawable着色
矢量图用于:
1.AppcomatImageView 2. AppcompatImageButton 3.ImageView 4.ImageButton等StateListDrawable,InsetDrawable,LayerDrawable,LevelListDrawable,RotateDrawable
3和4使用时要加上app:srcCompat="@drawable/****"
static { AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);}
ImageView imageView = (ImageView) findViewById(R.id.lorry);
imageView.setImageResource(R.drawable.lorry);
setBackgroundResource也是可以设置Vector的API
0 0
- 矢量图学习(二)
- ps学习笔记二(矢量图)
- 矢量图学习(一)
- WebGIS学习(七)WebGIS中栅格、矢量图层设计之栅格、矢量图层的本质
- GnuPlot作图(矢量图)
- 矢量图
- 矢量图
- 矢量图
- 多比矢量图开发指南(五)-定义矢量图元
- OpenLayers 学习(三)矢量图层上添加点绘制点、线、多边形
- 矢量图的多边形裁剪(作者:陈轶)
- 图像和图形(位图与矢量图)
- C#绘制矢量图(Metafile,WMF,EMF)
- 多比矢量图开发教程(三)
- VISIO生成流程图、结构图(矢量图)
- 常用思科设备图标(JPG+矢量图)
- SVG(可扩展矢量图)系列教程
- Android中使用SVG矢量图(一)
- POJ-3067-树状数组
- 09.异步Jobs
- Windows下的oracle 11g的入门
- ios跳转设置界面
- 响应式Web基础
- 矢量图学习(二)
- 66.二叉树的前序遍历
- Kafka _0.10.1.0 liunx安装
- 浏览器校验上传文件的大小
- CDQ分治——BZOJ1176 [Balkan2007]Mokia
- PostgreSQL学习手册(常用数据类型)
- linux命令之sync
- 微信小程序map地图整理
- 常见算法