本文介绍了Fabric.io usertimeline加载事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是从一个Fabric.io Twitter的饲料。

I'm using a Twitter feed from Fabric.io,.

要设置,我用这个方法:

To set up, I'm using this method:

final UserTimeline userTimeline = new UserTimeline.Builder()
    .screenName(screenname)
    .build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter(mContext, userTimeline);
listViewTweets.setAdapter(adapter);

我的目标是显示装载指示器,直到进料​​被加载,从而示出在视图中。
我该怎么做呢?

My goal is to show a loading indicator until the feed is loaded, thus shows in the view.How do I do this?

推荐答案

listViewTweets.setAdapter(适配器)之前; 插入

listviewo.setEmptyView(findViewById(R.id.loading));

加载一个进度把你的XML中,你必须在的ListView

loading is a ProgressBar put it inside your XML where you have the ListView:

<ProgressBar
        android:id="@+id/loading"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:indeterminateDrawable="@anim/loading_rotation"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:visibility="gone" />

本:的android:indeterminateDrawable =@动画/ loading_rotation我创建了一个旋转图片

要设置动画只是创建一个 XML 文件放在一个名为动画文件夹中:

to set the animation just create an xml file put it in a folder called anim :

<?xml version="1.0" encoding="utf-8"?>

<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/iconloading"
android:pivotX="50%"
android:pivotY="50%" />

加载图片 iconloading

希望这有助于。

这篇关于Fabric.io usertimeline加载事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 20:06