从Drawable的继承结构上看,还有几个没有介绍到。
1、ColorDrawable
ColorDrawable使用很简单,使用<Color>元素就可以定义一个ColorDrawable,然后再其他的地方使用。
在color.xml文件中定义:
<?xml version="1.0" encoding="utf-8"?>
<color xmlns:android="http://schemas.android.com/apk/res/android"
android:color="#00FF00">
</color>
在布局中使用:
<TextView
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="测试"
android:background="@drawable/color">
</TextView>
2、ShapeDrawable和PaintDrawable
都是用来绘制Shape的。不能通过xml文件创建,将在以后的Graphics中学习。
3、AnimationDrawable
用来创建动画的,因为有的动画并不是Drawable,所以将他归为anim Resource。将在以后学习动画的学习。
4、DrawableContainer
一个帮助类,包含了多个Drawable,你可以选中一个拿来使用。你也可以继承它重写自己的DrawableContainers。或者直接使用它的某个子类。
分享到:
相关推荐
Android SDK 19 系统使用的图标,一般可以通过android.R.drawable直接调用。自己设计控件外观时想用系统的图标,开始在网上搜索,没找到新的,后来在SDK的sdk\platforms\android-19\data\res路径下找到了。现在上传...
Android Drawable Importer Plugin This plugin consists of three main features. You can access them by right-clicking anywhere, but not on a file, inside an Android (library) module under New. ...
在res/drawable 下新建一个 Drawable Resource File 使用 layer-list 图层 就是说可以多个图层一层一层盖上去 新建一个渐变的图层 item作为背景图层,主要是 gradient,shape是用来定义形状的,corners设置角度,...
详细和全面演示了Android各种资源的定义和使用方法及其效果,可以在Android5.0以上系统运行,
flutter_local_notifications..zip,在android和ios上显示本地通知的flutter插件
Drawable对象的来源不限制,可以是从资源getResource().getDrawable(int resourceId)也可以是其他的方式得到的Drawable Drawable wrappedDrawable = DrawableCompat.wrap(drawable); DrawableCompat.setTint...
打开Android Studio软件,找到目录res下面子目录drawable目录,将动画图片素材拷贝到该目录下,本节课中,图片素材为img01至img06。;将鼠标选中drawable目录,点击鼠标右键。;在打开的 New Drableable Resource File...
最近有这样一个需求:A应用在一定条件下出发某个逻辑后,需要从B应用中获取一些资源(assets下的mp4视频、还有drawable下的一些图片用作背景),具体需求就不说啦哈哈,用一张图来表示应该更明白: A和B应用其实是1...
FancyBackground is a tiny Android library designed to animate a set of resource Drawables. It ensures the drawables are subsampled and cached, if necessary, with heavy lifting done in the background. ...
谷歌 Android 讲的很清楚,看得很模糊,这本书让你可以对Adnroid 看的很全面。抢占Android 市场,可能就在某个行业的将来抢占了一定的地位。 * 国内第一本全面介绍Android SDK的简体中文图书,目前为止最详细完整的...
一、shape 样式:(在drawable新建–》new–》Drawable resource file 在父级标签selector添加Item ) <?xml version=1.0 encoding=utf-8?> <selector xmlns:android=...
android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"> android:name=".ImagesWidgetConfiguration" android:label="@string/app_name"> android:name="android....
shape和selector是Android UI设计中经常用到的,比如...android:drawable=”@[package:]drawable/drawable_resource” android:state_pressed=[“true” | “false”] android:state_focused=[“true” | “false”
----------------------------------- Android 编程基础 1 封面----------------------------------- Android 编程基础 2 开放手机联盟 --Open --Open --Open --Open Handset Handset Handset Handset Alliance ...
这个小例子主要用到android手势部分和Mediaplayer部分的知识。 手势部分没啥问题,我们可以通过MotionEvent中定义的Event Code来判断当前手势的状态(按下或者释放等) imageButton_white1.setOnTouchListener(new...
Drawable Resources 154 Working with Images 156 Working with Color State Lists 158 Working with Animation 159 Working with Menus 162 Working with XML Files 163 Working with Raw Files 164 References to ...
It changes res/drawable/wechat to r/d/a, and renames the resource file wechat.png to a.png. Finally, it repackages the apk with 7zip, which can reduce the package size obviously. AndResGuard is fast,...
因为表情包实现比较麻烦,...在drawable里新建几个drawable resource file buttonbackground dialog_left dialog_right inputbackground 用到的颜色 #12de20 #12de20 #bfbfbf #ECE9E9 #F3F3F3 界面
3.4 置换TextView文字——CharSequence数据类型与Resource ID应用 3.5 取得手机屏幕大小——DisplayMetrics取得画面宽高的方法 3.6 样式化的定型对象——Style样式的定义 3.7 简易的按钮事件——...
7.1 访问Drawable资源的宽高——ContextMenu与Bitmap的应用 7.2 绘制几何图形——使用android.graphics类 7.3 手机屏幕保护程序——FadeIn/FadeOut特效与运行线程 7.4 用手指移动画面里的照片——onTouchEvent事件...