forked from donkingliang/ConsecutiveScroller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'permanent-feature' into master
- Loading branch information
Showing
7 changed files
with
264 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/src/main/java/com/donkingliang/consecutivescrollerdemo/PermanentStickyActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.donkingliang.consecutivescrollerdemo; | ||
|
||
import android.os.Bundle; | ||
import android.webkit.WebChromeClient; | ||
import android.webkit.WebView; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.recyclerview.widget.LinearLayoutManager; | ||
import androidx.recyclerview.widget.RecyclerView; | ||
|
||
import com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout; | ||
import com.donkingliang.consecutivescrollerdemo.adapter.RecyclerViewAdapter; | ||
|
||
public class PermanentStickyActivity extends AppCompatActivity { | ||
|
||
private ConsecutiveScrollerLayout scrollerLayout; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_sticky_permanent); | ||
|
||
scrollerLayout = findViewById(R.id.scrollerLayout); | ||
|
||
WebView webView = findViewById(R.id.webView); | ||
webView.loadUrl("https://github.com/donkingliang"); | ||
|
||
webView.setWebChromeClient(new WebChromeClient() { | ||
@Override | ||
public void onProgressChanged(WebView view, int newProgress) { | ||
super.onProgressChanged(view, newProgress); | ||
// 在webView加载的过程中,用户滚动了webView内容,可能会使webView的显示与scrollerLayout断层, | ||
// 需要让scrollerLayout重新检查一下所有View的显示位置 | ||
scrollerLayout.checkLayoutChange(); | ||
} | ||
}); | ||
|
||
|
||
RecyclerView recyclerView1 = findViewById(R.id.recyclerView1); | ||
recyclerView1.setLayoutManager(new LinearLayoutManager(this)); | ||
RecyclerViewAdapter adapter1 = new RecyclerViewAdapter(this,"RecyclerView1-"); | ||
recyclerView1.setAdapter(adapter1); | ||
|
||
RecyclerView recyclerView2 = findViewById(R.id.recyclerView2); | ||
recyclerView2.setLayoutManager(new LinearLayoutManager(this)); | ||
RecyclerViewAdapter adapter2 = new RecyclerViewAdapter(this,"RecyclerView2-"); | ||
recyclerView2.setAdapter(adapter2); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/scrollerLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layout_isPermanent="true" | ||
android:scrollbars="vertical"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@android:color/white" | ||
android:padding="10dp" | ||
android:text="吸顶View - 1" | ||
android:textColor="@android:color/black" | ||
android:textSize="18sp" | ||
app:layout_isSticky="true" /> | ||
|
||
<WebView | ||
android:id="@+id/webView" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@android:color/white" | ||
android:orientation="vertical" | ||
app:layout_isSticky="true"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:padding="10dp" | ||
android:text="吸顶View - 2 我是个LinearLayout" | ||
android:textColor="@android:color/black" | ||
android:textSize="18sp" /> | ||
|
||
</LinearLayout> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/recyclerView1" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@android:color/white" | ||
android:padding="10dp" | ||
android:text="吸顶View - 3" | ||
android:textColor="@android:color/black" | ||
android:textSize="18sp" | ||
app:layout_isSticky="true" /> | ||
|
||
<androidx.core.widget.NestedScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="@android:color/holo_blue_bright" | ||
android:gravity="center" | ||
android:orientation="vertical"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="200dp" | ||
android:gravity="center" | ||
android:text="NestedScrollView" | ||
android:textColor="@android:color/black" | ||
android:textSize="24sp" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="200dp" | ||
android:gravity="center" | ||
android:text="NestedScrollView" | ||
android:textColor="@android:color/black" | ||
android:textSize="24sp" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="200dp" | ||
android:gravity="center" | ||
android:text="NestedScrollView" | ||
android:textColor="@android:color/black" | ||
android:textSize="24sp" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="200dp" | ||
android:gravity="center" | ||
android:text="NestedScrollView" | ||
android:textColor="@android:color/black" | ||
android:textSize="24sp" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="200dp" | ||
android:gravity="center" | ||
android:text="NestedScrollView" | ||
android:textColor="@android:color/black" | ||
android:textSize="24sp" /> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="200dp" | ||
android:gravity="center" | ||
android:text="NestedScrollView" | ||
android:textColor="@android:color/black" | ||
android:textSize="24sp" /> | ||
|
||
</LinearLayout> | ||
</androidx.core.widget.NestedScrollView> | ||
|
||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@android:color/white" | ||
android:padding="10dp" | ||
android:text="吸顶View - 4" | ||
android:textColor="@android:color/black" | ||
android:textSize="18sp" | ||
app:layout_isSticky="true" /> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/recyclerView2" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
|
||
</com.donkingliang.consecutivescroller.ConsecutiveScrollerLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters