当前位置:网站首页>Basic use of swiperefreshlayout, local refresh of flutterprovider
Basic use of swiperefreshlayout, local refresh of flutterprovider
2022-06-26 07:36:00 【m0_ sixty-six million two hundred and sixty-five thousand and o】
public class MainActivity extends AppCompatActivity {
private SwipeRefreshLayout swipeRefreshLayout;
@SuppressLint(“ResourceAsColor”)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
SwipeRefreshLayout swip_refresh_layout=findViewById(R.id.swipeLayout);
swip_refresh_layout.setColorSchemeResources(R.color.colorPrimary);
}

5.setProgressBackgroundSchemeResource(int coloRes), Set the background color of the drop-down progress
public class MainActivity extends AppCompatActivity {
private SwipeRefreshLayout swipeRefreshLayout;
@SuppressLint(“ResourceAsColor”)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
SwipeRefreshLayout swip_refresh_layout=findViewById(R.id.swipeLayout);
swip_refresh_layout.setColorSchemeResources(R.color.colorPrimary); swip_refresh_layout.setProgressBackgroundColorSchemeColor(R.color.colorPrimaryDark);
}

6.setRefreshing(boolean refreshing) Set refresh status ,false On behalf of stop execution
swip_refresh_layout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
swip_refresh_layout.setRefreshing(false);
}
},2000);
}
});

7. When it's all sorted out , Plus a couple of item, The complete code is as follows
package com.example.swiperefreshlayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
private SwipeRefreshLayout swipeRefreshLayout;
private String[] names = new String[]
{“Lion”,“Tiger”,“Monkey”,“Dog”,“Cat”,“Elephant”};
@SuppressLint(“ResourceAsColor”)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout);
// establish list aggregate
ListView list = findViewById(R.id.aa);
List<Map<String,Object>> listItems =
new ArrayList<>();
for (int i=0;i<names.length;i++)
{
Map<String,Object> listItem =new HashMap<>();
listItem.put(“names”,names[i]);
listItems.add(listItem);
}
SimpleAdapter simpleAdapter=new SimpleAdapter(this,listItems,R.layout.item,
new String[]{“names”}
,new int[]{R.id.names});
list.setAdapter(simpleAdapter);
//SwipeRefreshLayout Function is introduced
final SwipeRefreshLayout swip_refresh_layout=findViewById(R.id.swipeLayout);
swip_refresh_layout.setColorSchemeResources(R.color.colorPrimary);
swip_refresh_layout.setProgressBackgroundColorSchemeColor(R.color.colorPrimaryDark);
swip_refresh_layout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
swip_refresh_layout.setRefreshing(false);
}
},2000);
}
});
}
}
item.xml
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”
android:layout_width=“match_parent”
android:layout_height=“match_parent”>
<TextView
android:id="@+id/names"
android:layout_width=“match_parent”
android:layout_height=“70dp”
android:paddingLeft=“10dp”
android:layout_marginTop=“5dp”
android:textColor="@color/colorPrimaryDark"
android:textSize=“30dp” />
layout.xml
<?xml version="1.0" encoding="utf-8"?><androidx.swiperefreshlayout.widget.SwipeRefreshLayout
xmlns:android=“http://schemas.android.com/apk/res/android”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:orientation=“vertical”
summary
Finally, for programmers , What to learn 、 There's too much technology , If you want not to be eliminated by the environment, you have to constantly improve yourself , It's always us to adapt to the environment , Not the environment to adapt us !
Here are dozens of sets related to the above technical system diagram tencent 、 headlines 、 Ali 、 Meituan and other companies 2021 Interview questions for , Put the technical points into video and PDF( In fact, it took a lot more energy than expected ), contain The context of knowledge + A lot of details , Due to limited space , Here is a part of it in the form of pictures .
I believe it will bring you a lot of harvest :


Above 【 HD technology brain map 】 as well as 【 Supporting architecture technology PDF】 You can follow me for free
Android Study PDF+ Architecture video + Interview document + Source notes
(img-ZdavZF1h-1645006090792)]
Above 【 HD technology brain map 】 as well as 【 Supporting architecture technology PDF】 You can follow me for free
Android Study PDF+ Architecture video + Interview document + Source notes
It's easy to be a programmer , To be a good programmer is to keep learning , From junior programmer to senior programmer , From junior architect to senior architect , Or go to management , From technical manager to technical director , Each stage requires different abilities . Set your career direction early , In order to get rid of peers in work and ability improvement .
边栏推荐
- 快速找到优质对象的5种渠道,赶紧收藏少走弯路
- Calculate division in Oracle - solve the error report when the divisor is zero
- Scratch program learning
- I3wm get window class
- Jemter 压力测试 -可视化工具-【使用篇】
- In interface testing, several methods to verify the success of deleting interfaces
- Request&Response
- Redis(4)----浅谈整数集合
- 3,3 '- di (3,4-dicarboxyphenoxy) -4,4' - diphenylethynylbiphenyldianhydride (bpebpda) / porphyrin 2dcofs (H2P COF, ZNP COF and cup COF) supplied by Qiyue
- Esp32-c3 introductory tutorial WiFi part ⑥ - WIFI intelligent distribution network based on serial port
猜你喜欢

Median segmentation (find rules) - Niuke

Flutter (III) - master the usage of dart language in an article
![[UVM basics] understanding of sequence and sequencer](/img/74/ff451e500d0b7154d7bb95398eaef0.jpg)
[UVM basics] understanding of sequence and sequencer

Attention mechanism yyds, AI editor finally bid farewell to P and destroyed the whole picture

Cache usage

Tetradecanoxy tetraphenylporphyrin methacrylate mm-tpp-14c; Cetanoxy tetraphenyl porphyrin methacrylate mm-tpp-16c; Purple solid; Qiyue supply

Porphyrin based polyimide ppbpis (ppbpi-pa, ppbpi-pepa and ppbpi-pena); Crosslinked porphyrin based polyimide (ppbpi-pa-cr, ppbpi-pepa-cr, ppbpi-pena-cr) reagent

Important reference indicators for data center disaster recovery: RTO and RPO
![[recommend 10 easy idea plug-ins with less tedious and repetitive code]](/img/74/69ca02e3d83404f7b0df07c308a59d.png)
[recommend 10 easy idea plug-ins with less tedious and repetitive code]

3D porphyrin MOF (mof-p5) / 3D porphyrin MOF (mof-p4) / 2D cobalt porphyrin MOF (ppf-1-co) / 2D porphyrin COF (POR COF) / supplied by Qiyue
随机推荐
Yyds dry inventory Druid connection pool usage
基于sanic的服务使用celery完成动态修改定时任务
Young man, do you know the original appearance of kotlin association process?
2021 project improvement
INSERT IGNORE 与INSERT INTO的区别
十大证券公司哪个佣金手续费最低,最安全可靠?
Take you three minutes to get started typescript
A bold sounding and awesome operation - remake a Netflix
Jmeter压力测试-Web代理本地接口测试【教学篇】
ES字符串类型(Text vs keyword)的选择
Exploration and practice of incremental data Lake in station B
职场“大冤种”,不仅身累,心也被掏空……
[UVM basics] TLM common data receiving and sending and data receiving examples
Junit
Porphyrin based polyimide (ppbpis); Synthesis of crosslinked porphyrin based polyimides (ppbpi CRS) porphyrin products supplied by Qiyue biology
The difference between insert ignore and insert into
Web technology sharing | webrtc recording video stream
You can command Siri without making a sound! The Chinese team of Cornell University developed the silent language recognition necklace. Chinese and English are OK
Esp32-c3 introductory tutorial WiFi part ⑥ - WIFI intelligent distribution network based on serial port
Children play games (greed, prefix and) - Niuke winter vacation training camp