feat:fix shaking when drag

This commit is contained in:
pengfei.zhou
2019-11-25 18:54:27 +08:00
parent d3b2d4c8bd
commit a47b3682db
4 changed files with 35 additions and 15 deletions

View File

@@ -34,6 +34,7 @@ import java.util.List;
import pub.doric.DoricActivity;
import pub.doric.devkit.ui.DemoDebugActivity;
import pub.doric.pullable.DoricSwipeLayout;
import pub.doric.utils.DoricUtils;
public class MainActivity extends AppCompatActivity {
@@ -43,6 +44,13 @@ public class MainActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final DoricSwipeLayout swipeLayout = findViewById(R.id.swipe_layout);
swipeLayout.setOnRefreshListener(new DoricSwipeLayout.OnRefreshListener() {
@Override
public void onRefresh() {
swipeLayout.setRefreshing(false);
}
});
RecyclerView recyclerView = findViewById(R.id.root);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
try {

View File

@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
<pub.doric.pullable.DoricSwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:id="@+id/swipe_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" />
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" />
</pub.doric.pullable.DoricSwipeLayout>