如何增加启动画面的计时器?我需要它慢一点。
public class MainActivity extends Activity {
private Handler mHandler = new Handler();
ImageView imageview;
int alpha = 255;
int b = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageview = (ImageView) this.findViewById(R.id.imageView1);
imageview.setAlpha(alpha);
new Thread(new Runnable() {
public void run() {
initApp();
while (b < 2) {
try {
if (b == 0) {
Thread.sleep(1000);
b = 1;
} else {
Thread.sleep(50);
}
updateApp();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
imageview.setAlpha(alpha);
imageview.invalidate();
}
};
}
public void updateApp() {
alpha -= 5;
if (alpha <= 0)
{
b = 2;
Intent in = new Intent(this, TabsLayoutActivity.class);
startActivity(in);
this.finish();
}
mHandler.sendMessage(mHandler.obtainMessage());
}
public void initApp(){
}
}