MaterialRefreshLayout, swiperefreshlayout

Source: Internet
Author: User

MaterialRefreshLayout, swiperefreshlayout

 

The above introduces a more beautiful and powerful drop-down refreyout control than SwipeRefreshLayout: Android-MaterialRefreshLayout

1. 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">        <com.cjj.MaterialRefreshLayout          xmlns:android="http://schemas.android.com/apk/res/android"          xmlns:app="http://schemas.android.com/apk/res-auto"          android:id="@+id/refresh"          app:wave_color="@color/material_green"          android:layout_width="match_parent"          android:layout_height="match_parent"          >         <ListView           android:background="#FF0000"           android:layout_width="match_parent"           android:layout_height="match_parent"></ListView>        </com.cjj.MaterialRefreshLayout>  </LinearLayout> 

2. Java

Package com. frame. activity; import android. app. activity; import android. OS. bundle; import android. OS. handler; import android. widget. toast; import com. cjj. materialRefreshLayout; import com. cjj. materialRefreshListener; import com. frame. r; public class TestActivity extends Activity {MaterialRefreshLayout materialRefreshLayout; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. test_activity_test); materialRefreshLayout = (MaterialRefreshLayout) findViewById (R. id. refresh); // supports pulling more materialRefreshLayout. setLoadMore (true); materialRefreshLayout. setMaterialRefreshListener (new MaterialRefreshListener () {@ Override public void onRefresh (final MaterialRefreshLayout materialRefreshLayout) {new Handler (). postDelayed (new Runnable () {@ Override public void run () {// pull down to refresh more Toast. makeText (TestActivity. this, "onRefresh... ", Toast. LENGTH_LONG ). show (); materialRefreshLayout. finishRefresh (); }}, 3000) ;}@ Override public void onRefreshLoadMore (final MaterialRefreshLayout materialRefreshLayout) {new Handler (). postDelayed (new Runnable () {@ Override public void run () {// load more Toast. makeText (TestActivity. this, "onRefreshLoadMore... ", Toast. LENGTH_LONG ). show (); materialRefreshLayout. finishRefreshLoadMore () ;}, 3000 );}});}}

  

3. Reference website

Https://github.com/android-cjj/Android-MaterialRefreshLayout/blob/master/README-cn.md

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.