ClipDrawable 资源
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:src="@drawable/my_clip"
/>
</LinearLayout>
<?xml version="1.0" encoding="UTF-8"?>
<clip xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/shuangta"
android:clipOrientation="horizontal"
android:gravity="center">
</clip>
package org.crazyit.res; import java.util.Timer;
import java.util.TimerTask; import org.crazyit.res.R; import android.app.Activity;
import android.graphics.drawable.ClipDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView; /**
* Description:
* <br/>site: <a href="http://www.crazyit.org">crazyit.org</a>
* <br/>Copyright (C), 2001-2014, Yeeku.H.Lee
* <br/>This program is protected by copyright laws.
* <br/>Program Name:
* <br/>Date:
* @author Yeeku.H.Lee kongyeeku@163.com
* @version 1.0
*/
public class ClipDrawableTest extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView imageview = (ImageView) findViewById(R.id.image);
// 获取图片所显示的ClipDrawable对象
final ClipDrawable drawable = (ClipDrawable)
imageview.getDrawable();
final Handler handler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
// 如果该消息是本程序所发送的
if (msg.what == 0x1233)
{
// 修改ClipDrawable的level值
drawable.setLevel(drawable.getLevel() + 200);
}
}
};
final Timer timer = new Timer();
timer.schedule(new TimerTask()
{
@Override
public void run()
{
Message msg = new Message();
msg.what = 0x1233;
// 发送消息,通知应用修改ClipDrawable对象的level值。
handler.sendMessage(msg);
// 取消定时器
if (drawable.getLevel() >= 10000)
{
timer.cancel();
}
}
}, 0, 300);
}
}

ClipDrawable 资源的更多相关文章
- android学习笔记34——ClipDrawable资源
ClipDrawable ClipDrawable代表从其他位图上截取一个“图片片段” 在XML文件中定义ClipDrawable对象使用<clip.../>元素,该元素的语法为: 以上语 ...
- Android使用Drawable资源之使用ClipDrawable资源 实现进入条
以前我自定义的进度条(就是咱们现在工程中用的)是从android的源码中扒出来的一个XML,然后把里面的图片给替换了.一直不知道它的具体原理是什么. 今天得空研究了一下,发现它的原理其实就是用的and ...
- 使用(Drawable)资源———ClipDrawable资源
ClipDrawable代表从其他位图上截取的一个"图片片段".在XML文件中定义ClipDrawable对象使用<clip.../>元素,该元素的语法为: <? ...
- Android中的Drawable资源
在Android应用中,常常会用到Drawable资源,比如图片资源等,在Android开发中我们是用Drawable类来Drawable类型资源的. Drawable资源一般存储在应用程序目录的\r ...
- Android的stateListDrawable,layerDawable,clipdrawable,AnimationDarwable介绍-android学习之旅(五十五)
StatelistDrawable资源 代码示例 <?xml version="1.0" encoding="utf-8"?> <select ...
- Android学习15--使用(Drawable)资源
1.图片资源 图片资源是最简单的Drawable资源.仅仅要把*.png.*.jpg*..gif等格式的图片放入/res/drawable-XXX文件夹下,Android SDK就会在编译应用自己主动 ...
- Drawable资源的初步使用
刚開始接触到Android的时候,看到类似以下的一个Button: 当时感觉这种button有点像Material Design风格.真的以为是裁剪好的图片,好奇心驱使我上网查找实现的方法,原来不是裁 ...
- android中常见的Drawable资源有哪些?
Drawable资源是安卓应用中最常见的一种资源,比如图片等,因此,对于初学者而言,必须掌握drawable资源相关应用. 今天在网上刚好看到了一篇介绍android Drawable资源的文章,分享 ...
- Android应用资源
Java刚開始学习的人直接在Java源代码使用"hello" 和123 类型的字符串和整型.但时间长了就会忘记当初定义的原因,有经验的或许会定义字符串常量ResultSet.TYP ...
随机推荐
- linux —— 学习笔记(软件操作:安装、卸载、执行)
目录: 0.相关基本命令 1.安装软件 2.卸载软件 3.打开软件 0.相关基本命令 与软件操作相关的主要命令有:dpkg 和 apt-get . dpkg : “dpkg ...
- webservice使用基本技巧
一,webService基本概念 webService也叫XMLWeb SerVice WebService是一种可以接收从Internet或者Intranet上的其它系统中传递过来的请求,轻量级的独 ...
- [Angular 2] Exposing component properties to the template
Showing you how you can expose properties on your Controller to access them using #refs inside of yo ...
- 1小时学Python脚本
如果我们有这么一项任务:简单測试局域网中的电脑是否连通.这些电脑的ip范围从192.168.0.101到192.168.0.200. 思路:用shell编程.(Linux一般是bash而 ...
- Android Touch系统简介(二):实例详解onInterceptTouchEvent与onTouchEvent的调用过程
上一篇文章主要讲述了Android的TouchEvent的分发过程,其中有两个重要的函数:onInterceptTouchEvent和onTouchEvent,这两个函数可被重装以完成特定的逻辑.on ...
- android之interpolator的用法详解
Android:interpolator Interpolator 被用来修饰动画效果,定义动画的变化率,可以使存在的动画效果accelerated(加速),decelerated(减速),repea ...
- jq實現網頁個性title
<!DOCTYPE html> <html content="text/html; charset=UTF-8"> <title>tooltip ...
- android基础篇学习心得
android技术中,线程.进程.JNI.IPC和各个小框架结构是基本功.在跟随高焕堂老师的android程序猿到架构师之路系列视频中 学习完基础篇之后,颇有些心得,记录下来. android开发就是 ...
- 洛谷比赛 Joe的数
/* 开始暴力+滚动数组70 后来发现不用循环很多 找p的倍数 找%p意义下为0的就好了 */ #include<iostream> #include<cstdio> #inc ...
- C#解leetcode 18. 4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = tar ...