制作动画效果的Button
2014-03-19 11:05
295 查看
转自:http://stackoverflow.com/questions/5918592/i-need-to-make-this-animation-display-as-a-button-background
Question:
if anyone could help I would be really appreciative. Basically I want to get this animated GIF or whatever it needs, to be displayed as a button background. When I click the button I want it to change to this animation that shows a spinner spinning. Any
idea how to get this animated GIF to work as a button background as a drawable?
Answer:
Here is how I would do it. First split the GIF and add each image to your drawable folder. Then add new xml file to your drawable (animation.xml).... see example below
Then when you want it to start call it with this example below....
参考链接:https://forums.xamarin.com/discussion/209/create-animation-in-the-button
Question:
if anyone could help I would be really appreciative. Basically I want to get this animated GIF or whatever it needs, to be displayed as a button background. When I click the button I want it to change to this animation that shows a spinner spinning. Any
idea how to get this animated GIF to work as a button background as a drawable?
Answer:
Here is how I would do it. First split the GIF and add each image to your drawable folder. Then add new xml file to your drawable (animation.xml).... see example below
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:drawable="@drawable/santa1" android:duration="200" /> <item android:drawable="@drawable/santa2" android:duration="200" /> <item android:drawable="@drawable/santa3" android:duration="200" /> <item android:drawable="@drawable/santa4" android:duration="200" /> <item android:drawable="@drawable/santa5" android:duration="200" /> <item android:drawable="@drawable/santa6" android:duration="200" /> <item android:drawable="@drawable/santa7" android:duration="200" /> </animation-list>
Then when you want it to start call it with this example below....
b_1.setBackgroundResource(R.drawable.animation); AnimationDrawable b1Amin = (AnimationDrawable) b_1.getBackground(); b1Amin.start();
参考链接:https://forums.xamarin.com/discussion/209/create-animation-in-the-button
相关文章推荐
- 利用CSS3制作淡入淡出动画效果
- 详解用CSS3制作圆形滚动进度条动画效果
- SilverLight开发系列第3步:制作鼠标跟随效果,顺便熟悉一些基本概念:群组 和 动画
- [CSS3]制作50个超棒动画效果教程
- Sprites图+JavaScript制作动画效果
- Flash AS3.0教程:如何载入库中的影片剪辑将制作成动画效果 将影片剪辑变成类[转]
- 纯CSS3制作卡通场景汽车动画效果
- Button点击缩放动画效果
- HTML5可以制作非常华丽的动画效果
- CSS3+Jquery制作的动画效果电子表
- 用Geogebra制作一些动画效果,也是对数学基础的一次检验
- android动画效果的制作
- Photoshop教大家快速制作花瓣飘落动画效果
- 使用HTML5 SVG和CSS3制作边框运动的动画效果
- QPropertyAnimation 几行代码快速制作流畅的动画效果
- transition:all 0.5s linear;进度条动画效果 制作原理
- Android用surfaceView制作动画效果
- 超炫button按钮动画效果
- belnd制作太阳光动画效果
- 【图解】通过Expression Blend快速制作具有物理效果的动画游戏