美文网首页
安卓app项目drawable目录作用

安卓app项目drawable目录作用

作者: 长点点 | 来源:发表于2023-03-15 14:22 被阅读0次

可绘制资源是图形的一般概念,可以绘制到屏幕上,您可以使用getDrawable(int)等API检索,也可以应用到另一个具有“android:drawable”和“android:icon”等属性的XML资源。有几种不同类型的抽屉:

位图文件

创建BitmapDrawable

创建NinePatchDrawable

一个Drawable,用于管理一系列其他Drawable。这些是按数组顺序绘制的,因此索引最大的元素将绘制在顶部。创建

一个XML文件,它为不同的状态引用不同的位图图形(例如,在按下按钮时使用不同的图像)。创建StateListDrawable

级别列表

一个XML文件,用于定义一个可绘制文件,该文件管理多个备用可绘制文件(每个可绘制文件都分配了一个最大数值)。创建LevelListDrawable

可绘制过渡

一个XML文件,用于定义可在两个可绘制资源之间交叉淡入淡出的可绘制资源。创建可过渡绘制

嵌入式可绘制

一个XML文件,用于定义一个可绘制对象,并将另一个可绘图对象插入指定的距离。当视图需要比视图的实际边界小的背景绘制时,这很有用。

可绘制的夹子

一个XML文件,它定义了一个可绘制文件,并根据该可绘制文件的当前级别值剪裁另一个可绘图文件。创建ClipDrawable

可绘制比例

一个XML文件,该文件定义了一个可绘制文件,该可绘制文件根据其当前级别值更改另一个可绘图文件的大小。创建可缩放绘制

可绘制形状

一个XML文件,用于定义几何形状,包括颜色和渐变。创建GradientDrawable

另请参阅动画资源文档,了解如何创建AnimationDrawable

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:

Bitmap File

Creates a BitmapDrawable

Creates a NinePatchDrawable

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

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

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 a TransitionDrawable

Inset Drawable

An XML file that defines a drawable that insets another drawable by a specified distance. This is useful when a View needs a background drawable that is smaller than the View's actual bounds.

Clip Drawable

An XML file that defines a drawable that clips another Drawable based on this Drawable's current level value. Creates a ClipDrawable

Scale Drawable

An XML file that defines a drawable that changes the size of another Drawable based on its current level value. Creates a ScaleDrawable

Shape Drawable

An XML file that defines a geometric shape, including colors and gradients. Creates a GradientDrawable

Also see the Animation Resource document for how to create an AnimationDrawable

相关文章

  • 第一次课小结

    主要了解安卓系统架构、安卓应用开发特色、环境的搭建和Java项目里各目录的作用。学会如何更改程序图标、应用名称及在...

  • React Native真机运行篇

    启动项目 打开终端,cd到项目目录,输入指令启动项目 安卓真机运行 1.连接安卓手机 1)打开安卓手机的开发者模式...

  • 安卓项目遇上ReactNative

    #######参考 @江清清 @Allen 最终安卓项目目录结构最终如下 1.新建原生安卓MyApplacatio...

  • AndroidManifest.xml到底是什么?

    每个安卓应用项目必须在根目录中加入 AndroidManifest.xml 文件,它到底是什么,到底有什么作用? ...

  • Cordova入门浅析

    目录结构 查看安卓的项目,只有两个module:app和CordovaLib; 入口 代码的入口,只有一个就是Ma...

  • Jenkins持续集成体系建设

    目录 任务目标 安卓App构建、打包、部署与自动化测试 安卓App持续集成体系建设实战 一、任务目标 实战任务的故...

  • React Native安卓随记

    1.启动安卓服务 在项目根目录执行: $ react-native run-android 2.安卓打包apk 进...

  • Android--vector动画

    上次说了SVG在安卓中的应用,在我们安卓系统中SVG就是Vector Drawable,Vector除了显示SVG...

  • 【翻译】安卓架构组件(6)-Room持久化类库

    相关文章: 【翻译】安卓架构组件(1)-App架构指导 【翻译】安卓架构组件(2)-添加组件到你的项目中 【翻译】...

  • 【翻译】安卓架构组件(4)-LiveData

    相关文章: 【翻译】安卓架构组件(1)-App架构指导 【翻译】安卓架构组件(2)-添加组件到你的项目中 【翻译】...

网友评论

      本文标题:安卓app项目drawable目录作用

      本文链接:https://www.haomeiwen.com/subject/fvmlrdtx.html