当前位置:网站首页>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 .
边栏推荐
- The first multi platform webcast of 2021ccf award ceremony pays tribute to the winners! CCF outstanding engineer
- Golang源码包集合
- Jemter 壓力測試 -基礎請求-【教學篇】
- C implementation adds a progress bar display effect to the specified column of the GridView table in devaxpress - code implementation method
- C#实现给DevExpress中GridView表格指定列添加进度条显示效果——代码实现方式
- Nine hours, nine people and nine doors (01 backpack deformation) - Niuke
- i3wm 获取window class
- ES字符串类型(Text vs keyword)的选择
- [UVM basics] TLM common data receiving and sending and data receiving examples
- Redis(5)----浅谈压缩列表
猜你喜欢
PXRD, IR, TGA of two-dimensional porphyrin COF (POR COF) /cof (2D pdpor COF) - supplied by Qiyue
How can I find the completely deleted photos in Apple mobile phone?
Attention mechanism yyds, AI editor finally bid farewell to P and destroyed the whole picture
Porphyrin based polyimide (ppbpis); Synthesis of crosslinked porphyrin based polyimides (ppbpi CRS) porphyrin products supplied by Qiyue biology
In interface testing, several methods to verify the success of deleting interfaces
Yyds dry inventory kubernetes easy service discovery and load balancing (11)
Jemter stress test - visualization tool - [usage]
缓存使用
GMP model
i3wm 获取window class
随机推荐
Children play games (greed, prefix and) - Niuke winter vacation training camp
The long path of Xiao Sha (graph theory, Euler diagram)
Quickly find five channels for high-quality objects, quickly collect and avoid detours
Iron / zinc / copper / platinum metal complexes such as 5,10,15,20-tetra (4-hydroxyphenyl) porphyrin (THPP) / (thppfe) / (thppzn) / (thppcu) / (thpppt) - Qiyue R & D
oracle创建带返回值的存储过程并sql执行调用
A bold sounding and awesome operation - remake a Netflix
Request&Response
[UVM practice] Chapter 2: a simple UVM verification platform (5) build test cases
This article will take you to learn in detail what is FTTH
Junit
Tetradecanoxy tetraphenylporphyrin methacrylate mm-tpp-14c; Cetanoxy tetraphenyl porphyrin methacrylate mm-tpp-16c; Purple solid; Qiyue supply
QTreeWidget And QTableWidget
Liangshui Xianmu shows his personal awareness as a unity3d worker
[UVM basics] TLM common data receiving and sending and data receiving examples
How to quickly merge multiple PDF files?
执行npm install -g serve时报错权限权限问题解决方案
i3wm 获取window class
Item2 installation configuration and environment failure solution
Median segmentation (find rules) - Niuke
[UVM basics] understanding of sequence and sequencer