如何(自动)选取框Android的图片? [英] how to marquee images in android (automatically)?

查看:116
本文介绍了如何(自动)选取框Android的图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在HTML中可用的字幕功能,在我的Andr​​oid application.I不知道该怎么做,我们把它称为android系统。

I want to have the marquee functionality available in html in my android application.I don't know what do we call it in android.

例如,我有四到五images.they需要的帐篷无论是从左至右或从右到左。(自动)

for example,I have four to five images.they need be marquee either from left to right or from right to left.(automatically)

1注,我不是问水平滚动视图

的程序是什么,我怎么能得到这个功能?

What is the procedure and How can i get this feature?

推荐答案

我得到了答案......我的问题

ITS AUTOSLIDER

 public class AutoSlider extends Activity {

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

    int[] IMAGE_IDS = {R.drawable.image1, R.drawable.image2, R.drawable.image3,
            R.drawable.image4};

    @Override
    protected void onCreate(Bundle savedInstanceState) 
{
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
        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());
      }
       private void AnimateandSlideShow() {

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

        currentimageindex++;

      }

}

和在XML刚刚布局,并与它的宽度,高度和位置的图像视图。

and in your XML have just the layout and the image view with its width,height and position.

这篇关于如何(自动)选取框Android的图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆