如何显示在屏幕的透明模式中的中心3 2 1文字 [英] How to display 3 2 1 text in the center of the screen in transparency mode
问题描述
首先,我是新的android开发和到处搜寻,但没有得到任何解决我的问题。所以,请不要率这篇文章否定的。
First of all, I am new to android development and searched everywhere but didn't get any solution to my problem. So please don't rate this post negative.
我正在其中我想在bixtext屏幕的中心显示3 2 1小游戏应用程序,它应在透明模式,使得下面的活性
3 2 1的文字应该是可见的,当它达到1,则该活动应该开始像任何一场比赛。
I am making a small game application in which I want to display 3 2 1 at the center of the screen in bixtext, and it should come in transparency mode such that the activity below the 3 2 1 text should be visible and when it reaches 1 then the activity should start like in any game.
推荐答案
添加的TextView
你的XML布局( textView123
在这里),而且也不会这么难走:
Add a TextView
to your xml layout (textView123
here) and that wouldn't be so hard to go:
final Handler handler = new Handler();
final TextView textView = (TextView) findViewById(R.id.textView123);
final java.util.concurrent.atomic.AtomicInteger n = new AtomicInteger(3);
final Runnable counter = new Runnable() {
@Override
public void run() {
textView.setText(Integer.toString(n.get()));
if(n.getAndDecrement() >= 1 )
handler.postDelayed(this, 1000);
else {
textView.setVisibility(View.GONE);
// start the game
}
}
};
handler.postDelayed(counter, 1000);
这篇关于如何显示在屏幕的透明模式中的中心3 2 1文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!