Android 如何在SD卡图像的所有活动中设置页脚视图的动画(如页脚添加googleadds等)
我是为android开发应用程序的新手,我需要一些帮助 我需要从SDCARD中的特定路径文件夹中为所有活动设置页脚中的图像动画,我使用页脚布局作为所有布局的通用布局 我已经通过编写以下代码编写了图像动画代码:Android 如何在SD卡图像的所有活动中设置页脚视图的动画(如页脚添加googleadds等),android,android-layout,android-widget,Android,Android Layout,Android Widget,我是为android开发应用程序的新手,我需要一些帮助 我需要从SDCARD中的特定路径文件夹中为所有活动设置页脚中的图像动画,我使用页脚布局作为所有布局的通用布局 我已经通过编写以下代码编写了图像动画代码: public void AnimateActionHandler() { try { Toast.makeText(this, "My Service AnimateActionHandler", Toast.LENGTH_LONG).show
public void AnimateActionHandler() {
try {
Toast.makeText(this, "My Service AnimateActionHandler", Toast.LENGTH_LONG).show();
final Handler mHandler = new Handler();
final Runnable mUpdateResults = new Runnable() {
public void run() {
AnimateandSlideShow();
}
};
int delay = 500; // delay for 1 sec.
int period = 1000; // repeat every 2 sec.
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
mHandler.post(mUpdateResults);
}
}, delay, period);
} catch (Exception e) {
// TODO: handle exception
}
}
public void AnimateandSlideShow() {
try {
Toast.makeText(this, "My Service AnimateandSlideShow", Toast.LENGTH_LONG).show();
if (Config.ImageFilelist.isEmpty()) {
Config.ImageFilelist = GetFileList(AddsPath);
}
if (Config.ImageFilelist.size() <= Config.currentimageindex) {
Config.currentimageindex = 0;
}
Toast.makeText(this, "ImageFilelist::"+Config.ImageFilelist.size(), Toast.LENGTH_LONG).show();
Log.d(TAG, "Config.currentimageindex::"+Config.currentimageindex);
Config.FooterBitmap = BitmapFactory.decodeFile(Config.ImageFilelist.get(Config.currentimageindex).toString());
Log.d(TAG, "Addbmp"+Config.FooterBitmap.getHeight());
Config.slidingimage = (ImageView) findViewById(R.id.goeasy_footer);
Config.slidingimage.setImageBitmap(Config.FooterBitmap);
Log.d(TAG, "JOSEafter");
Animation rotateimage = AnimationUtils.loadAnimation(this,R.anim.splash_anim);
Config.slidingimage.startAnimation(rotateimage);
Config.currentimageindex = Config.currentimageindex + 1;
if (Config.ImageFilelist.size() <= Config.currentimageindex) {
Config.currentimageindex = 0;
}
} catch (Exception e) {
Log.e(TAG, "Set image EXC"+e.toString());
e.printStackTrace();
// TODO: handle exception
}
catch (OutOfMemoryError oe) {
try{
}
catch (Exception e) {
// TODO: handle exception
}
// TODO: handle exception
}
}
public void AnimateActionHandler(){
试一试{
Toast.makeText(这是“我的服务AnimateActionHandler”,Toast.LENGTH_LONG.show();
最终处理程序mHandler=新处理程序();
最终可运行mUpdateResults=新可运行(){
公开募捐{
AnimateandSlideShow();
}
};
int delay=500;//延迟1秒。
int period=1000;//每2秒重复一次。
定时器=新定时器();
timer.scheduleAtFixedRate(新TimerTask(){
公开募捐{
mHandler.post(mUpdateResults);
}
},延误,期限);
}捕获(例外e){
//TODO:处理异常
}
}
public void AnimateandSlideShow(){
试一试{
Toast.makeText(这是“我的服务动画展示”,Toast.LENGTH_LONG.show();
if(Config.ImageFilelist.isEmpty()){
Config.ImageFilelist=GetFileList(AddsPath);
}
如果(Config.ImageFilelist.size(),为什么尽管android中有动画类功能,但仍使用代码进行动画制作
试试下面的例子
,和设置图像动画不为我着想,我需要为公共后台服务中的所有屏幕随机设置页脚中的图像,我将图像保存在SD卡中,我不希望调用每个活动,希望在后台服务中为特定的imageview设置