gpt4 book ai didi

android - 如何在android中使用不同图像在启动画面上显示动画

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:17:36 25 4
gpt4 key购买 nike

我有几个 Logo 图像,我想在我的初始屏幕上显示它,制作一个像拼图一样的完整 Logo 。我该怎么做。

我是第一次使用它,谁能帮帮我。

谢谢

最佳答案

package com.techipost.imageslider;

import android.app.Activity;
import android.os.Bundle;
import android.view.*;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.os.Handler;
import java.util.Timer;
import java.util.TimerTask;
import com.techipost.imageslider.R;

public class SliderActivity extends Activity {

public int currentimageindex=0;
Timer timer;
TimerTask task;
ImageView slidingimage;

private int[] IMAGE_IDS = {
R.drawable.splash0, R.drawable.splash1, R.drawable.splash2,
R.drawable.splash3
};

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mygame);
final Handler mHandler = new Handler();

// Create runnable for posting
final Runnable mUpdateResults = new Runnable() {
public void run() {

AnimateandSlideShow();

}
};

int delay = 1000; // delay for 1 sec.

int period = 8000; // repeat every 4 sec.

Timer timer = new Timer();

timer.scheduleAtFixedRate(new TimerTask() {

public void run() {

mHandler.post(mUpdateResults);

}

}, delay, period);



}

public void onClick(View v) {

finish();
android.os.Process.killProcess(android.os.Process.myPid());
}

/**
* Helper method to start the animation on the splash screen
*/
private void AnimateandSlideShow() {

slidingimage = (ImageView)findViewById(R.id.ImageView3_Left);
slidingimage.setImageResource(IMAGE_IDS[currentimageindex%IMAGE_IDS.length]);

currentimageindex++;

Animation rotateimage = AnimationUtils.loadAnimation(this, R.anim.custom_anim);

// slidingimage.startAnimation(rotateimage);

}


}

关于android - 如何在android中使用不同图像在启动画面上显示动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12351505/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com