`

Drawables

阅读更多
Drawables Drawable资源包括位图和9-Patch(可拉伸PNG)图片。它们以独立的文件存储在/res/drawable文件夹中。 位图资源的标识是不含后缀的小写文件名。 首选的位图格式是PNG,当然,JPG和GIF也是支持的。 9-Patch图片是指图片被标记的部分能够被拉伸的PNG文件,定义的时候需要以“.9.png”结尾。但其标识是文件名而不需要尾部的“.9.png”。 9-Patch是PNG图片的变种,它使用1个像素的边界来定义图片拉伸的区域。 创建9-Patch,先沿着图片的左上边界画1个像素的黑线来表示拉伸区域。其他未标记部分不会被拉伸,标记部分的相对大小会和图片大小变换一致。 9-Patch是为Views和Activities创建背景的一种最强大的工具,因为这些Views和Activities具有变化的大小。例如,Android使用9-patch为button创建背景。
分享到:
评论

相关推荐

    Android-Badge一系列的Android徽章Drawables

    这个项目,"Android-Badge一系列的Android徽章Drawables" 提供了一种简单的方法来创建和使用徽章样式,使得开发者可以方便地在应用图标、其他自定义视图上添加徽章元素。 在Android开发中,徽章通常表现为一个...

    Android-轻松从你的代码改变vectordrawables的颜色

    在Android开发中,Vector Drawables是一种非常有用的资源类型,它允许开发者创建矢量图形,这意味着它们可以在不同分辨率的设备上保持清晰,而不会因为放大而失真。然而,有时我们可能需要在运行时动态地改变这些...

    android矢量图之VectorDrawable ,自由又方便的填充色彩

    vectorDrawables.useSupportLibrary = true } ``` 然后在代码中使用`AppCompatResources`加载矢量图: ```java Drawable drawable = AppCompatResources.getDrawable(context, R.drawable.your_vector_drawable);...

    Shape_Drawables_Box:不断更新您的android项目的所有类型的形状可绘制对象

    在Android开发中,形状可绘制对象(Shape Drawables)是一种重要的资源类型,它们允许开发者创建自定义图形,如矩形、圆形、椭圆以及其他复杂的形状。`Shape_Drawables_Box`项目是一个专注于提供各种形状可绘制对象...

    android-drawables-maven-plugin-1.0.0.jar

    官方版本,亲测可用

    Android-Drawables:BlurDrawale,CircleDrawale ..

    Android-Drawables BlurDrawable(基于 ) new BlurDrawable (getResources(), bitmap, Gravity . FILL , // Blur Rect Gravity bitmap . getHeight() / 3 , // Blur Rect size true // Use Palette ); 去做 ...

    svg-android-converter:将 SVG 文件转换为 Android VectorDrawables

    svg-android-转换器 此工具用于将 SVG 文件转换为基于 Android Lollipop 的设备的 Android VectorDrawables。 用法:svg-android-converter <svg-file> <vector>

    依赖的drawable文件

    1. **Bitmap Drawables**:这是最常见的类型,包含JPEG、PNG、WEBP等格式的图像文件。这些文件通常存储在`res/drawable`目录下,用于显示静态图像。 2. **Vector Drawables**:自Android Lollipop(API 21)引入,...

    Android代码-清除

    What is this? This is a sample theme ...A rule of thumb is that you should make two drawables available: one for each side. The left one will be suffixed _left and the right one _right Currently, only on

    自定义带有删除功能的EditText

    setCompoundDrawablesRelative(drawables[0], drawables[1], drawables[2], drawables[3]); } } ``` 这样,我们就创建了一个自定义的ClearableEditText,它具有与苹果iOS类似的清除全部文本的功能。在实际项目中,...

    Android代码-materialdesignicons.com 图标封装

    All the drawables are awailable through: R.drawable/zzz_*icon_name_here* Icons follow the same naming scheme as on materialdesignicons.com, though they start with "zzz_" (to make them less cluttery ...

    android所有图标资源以及名称大全

    8. **Holo-themed Drawables**:这是Android 3.0(Honeycomb)引入的一套设计风格,包括了不同颜色和状态的图标,如`holo_dark`和`holo_light`。 9. **Material Design Icons**:自Android Lollipop版本开始,谷歌...

    Drawble的7种图像处理方式demo:shape、layers、scale、bitmap、等

    Layer-List Drawables允许你将多个Drawables组合成一个单一的图层,每个图层可以有不同的排列顺序和属性。这在实现复杂布局或动画时非常有用。例如,你可以创建一个包含背景图、前景图和中间按钮的图层列表,通过...

    The gdk-pixbuf Library

    Drawables to Pixbufs - Getting parts of a GDK drawable's image data into a pixbuf. Utilities - Utility and miscellaneous convenience functions. Animations - Animated images. GdkPixbufLoader - ...

    一个android变量矢量图(可以随时变出肥皂).zip

    在这个名为"一个android变量矢量图(可以随时变出肥皂).zip"的开源项目中,开发者利用了Android的Animated Vector Drawables特性来实现图形的动态变换,使得一个图标能够在运行时从Android变为苹果的形状,形象地...

    WorkingWithDrawables

    本篇文章将深入探讨如何在Android应用中工作与Drawables,以提升UI设计和用户体验。 1. **Drawable的基本类型** - **BitmapDrawable**: 用于显示位图图像,可以从本地文件、网络或资源中加载。 - **Shape ...

    Vector_demo

    与传统的Bitmap图片不同,Vector Drawables可以无限缩放而不失真,非常适合用作应用图标、按钮和其他UI元素。 2. **SVG格式**: SVG是一种开放标准的矢量图形语言,支持复杂的图形创作,如线条、曲线、形状以及渐变...

    带标签、删除按钮的EditText

    总结起来,实现“带标签、删除按钮的EditText”需要结合使用`EditText`的基本属性,以及`Compound Drawables`、自定义事件监听等技术,通过这些方法可以创建出符合设计需求的复杂输入组件。在Android应用开发中,...

    安卓Handler周期的改变图片

    drawables = new Drawable[] {getDrawable(R.drawable.image1), getDrawable(R.drawable.image2), ...}; // 开始图片轮播 handler.sendEmptyMessage(0); } private Drawable getNextDrawable() { ...

    MrFu-ArcMenu

    final int itemCount = ITEM_DRAWABLES.length; for (int i = 0; i ; i++) { ImageView item = new ImageView(this); item.setImageResource(ITEM_DRAWABLES[i]); final int position = i; menu.addItem(item, ...

Global site tag (gtag.js) - Google Analytics