如何使用Fabric自定义时间轴?

时间:2015-10-02 08:14:20

标签: android twitter-fabric

我正在尝试使用Fabric开发一个Twitter客户端应用程序。我已成功嵌入了家庭和用户时间表。但我想根据我的需要定制它们,例如在cardview上显示状态。我该怎么做?

final TweetViewFetchAdapter adapter =
        new TweetViewFetchAdapter<CompactTweetView>(
                getActivity());

public TimelineFragment(){}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_timeline, container, false);

    final ListView lv = (ListView)view.findViewById(R.id.hometimeline_list);

    StatusesService statusesService = Twitter.getApiClient().getStatusesService();

    statusesService.homeTimeline(200, null, null, null, null, null, null, new Callback<List<Tweet>>() {

        @Override
        public void success(Result<List<Tweet>> result) {

            adapter.setTweets(result.data);
            lv.setAdapter(adapter);
        }

        @Override
        public void failure(TwitterException e) {

        }
    });
    return view;
}

hometimeline.xml

<LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView android:id="@id/android:empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center_horizontal|center_vertical"/>

    <ListView android:id="@+id/hometimeline_list"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:drawSelectorOnTop="false"/>
</LinearLayout>

0 个答案:

没有答案