幻灯片实现的想法?

时间:2018-06-13 14:41:40

标签: android android-layout android-fragments android-animation android-view

关于如何在没有viewPager的情况下实现幻灯片的任何想法?所以问题是我有一个带有一个imageView的frameLayout,并且我有从服务器获取的x个图像网址,我想逐个显示这些图像,但有一些小的延迟。显示所有图像后,我只是想让那个frameLayout消失。我有的代码:

Fragment.java

@Override
public void setObject(final SomeObject someObject) {


    mFrameLayout.setVisibility(View.VISIBLE);

    for(int i = 0; i < someObject.getListImageObjects().size(); i++) {

        mHandler.postDelayed(new SlideShowTask(i, someoObject), 400);
    }

    mFrameLayout.setVisibility(View.GONE);


}

private class SlideShowTask implements Runnable {

    private int counter;
    private SomeObject someObject;

    public SlideShowTask(int counter, final SomeObject someObject) {
        this.counter = counter;
        this.someObject = someObject;
    }

    @Override
    public void run() {
        GlideApp.with(getActivity())
                .asDrawable()
                .load(someObject.getListImageObjects().get(counter).getUrlImageMainLarge())
                .into(ivSlideShow);


    }
}

但这不起作用,根本没有发生任何事情。因此,当我从服务器获取对象时,从演示者层调用setObject()方法。你能给我一些想法吗?提前谢谢。

0 个答案:

没有答案