相关疑难解决方法(0)

Android CountDownTimer显示1秒2秒

可能重复:
为什么millisUntilFinished无法检测到精确的CountDownTimer间隔?

为什么使用CountDownTimer两次显示"1"?我只是想让它顺利倒计时,而不是看起来它在最后一秒被挂断了.有人对如何解决这个问题有任何想法?

以下是Android Developers页面中的代码:

  new CountdownTimer(30000, 1000) {

     public void onTick(long millisUntilFinished) {
         mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
     }

     public void onFinish() {
         mTextField.setText("done!");
     }
  }.start();
Run Code Online (Sandbox Code Playgroud)

我创建了一个新项目并复制并粘贴了这段代码,以确保我不会在程序中意外搞乱.我一直在使用Tab 10.1进行测试.当我运行它时它会这样做:"5","4","3","2","1","1","完成!".

android

15
推荐指数
1
解决办法
1万
查看次数

Android倒计时

我想在android中写一个倒计时,从3到0开始计数.就像前三个出现然后消失,2出现等等.我搜索了很多,但我找不到任何好的样本.你能帮我说明我该怎么办?

android countdown

10
推荐指数
2
解决办法
9790
查看次数

如何在视图上创建带动画的倒数计时器

如何创建View这样的

在此输入图像描述

在测验游戏中,每个级别,这View将倒计时,选择的答案越快,得分就越高.所以,第一件事就是如何把时间花在这上面View.

android countdowntimer

1
推荐指数
1
解决办法
3044
查看次数

如何每隔 n 秒更改 imageview 中的图像

我制作了一个数组,其中包含 int 中的所有图像,我想在 imageView 中每 3 秒更改一次这些图像,我已经尝试了我能找到的所有解决方案,但显示了一些错误,我无法弄清楚。

java 文件(home.java)

/**
* Created by sukhvir on 17/04/2015.
*/
public class home extends android.support.v4.app.Fragment {

    ImageView MyImageView;
    int[] imageArray = { R.drawable.image1, R.drawable.image2, R.drawable.image3, R.drawable.image4, R.drawable.image5 };

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        /**
         * Inflate the layout for this fragment
        */
        return inflater.inflate(R.layout.home, container, false);
    }
}
Run Code Online (Sandbox Code Playgroud)

xml 文件(home.xml)

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"
        android:layout_gravity="center_horizontal" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

java xml android imageview

0
推荐指数
1
解决办法
3651
查看次数

标签 统计

android ×4

countdown ×1

countdowntimer ×1

imageview ×1

java ×1

xml ×1