• Stars
    star
    309
  • Rank 130,241 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android-TopScrollHelper

In the View with the function of scrolling of the code written for Android provides convenience for the user back to the top. If you double tap the top of the Android system bar The View with the ability to scroll to the top of the scroll are. Tap the system bar of iPhone features that are identical to scroll to the top.

Android developers can use this functionality with a simple code.

Analytics

ย  ย 

screens

ย ย  ย ย 

AutoScroll Support View

  • ScrollView
  • NestedScrollView
  • WebView
  • ListView
  • RecyclerView

ย ย  ย ย 

Instructions

  • Add the following permission to use the popup window on the Android Manifest.
<uses-permission android: name = "android.permission.SYSTEM_ALERT_WINDOW" />

ย ย  ย ย 

  • Add the view that the automatic scrolling feature scrolls to add to addTargetScrollView(view) method and removed removeTargetScrollView(view). Activity or Fragment of a scroll view allows calls to be fit to Create and Destory LifeCycle point.
@Override
protected void onCreate (Bundle savedInstanceState) {
  ย 
   super.onCreate(savedInstanceState);
   ...
   
  ย mNestedScrollView = (NestedScrollView)findViewById(R.id.scrollView);
ย   TopScrollHelper.getInstance(getApplicationContext()).addTargetScrollView(mNestedScrollView);
}

ย 

@Override
protected void onDestroy () {

   TopScrollHelper.getInstance(getApplicationContext()).removeTargetScrollView(mNestedScrollView);
ย   super.onDestroy();

}
  • The Android 6.0 (Marshmallow) Starting obtain permission directly, and then obtained permission to call the addTargetScrollView(view). ย ย  ย ย  ย ย 

Gradle

compile 'com.kmshack.library:android-topscroll-helper:1.0.0'

Download

Sample App Download

https://play.google.com/store/apps/details?id=com.kmshack.topscrollsample

Video

https://youtu.be/dlZoVnZoIVk



์•ˆ๋“œ๋กœ์ด๋“œ์˜ ์Šคํฌ๋กค์˜ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง„ View์—์„œ ์ตœ์ƒ๋‹จ์œผ๋กœ ๋Œ์•„๊ฐ€๊ธฐ ์œ„ํ•œ ์‚ฌ์šฉ์ž๋“ค์„ ํŽธ์˜์ œ๊ณต์„ ์œ„ํ•ด ์ž‘์„ฑ๋œ ์ฝ”๋“œ์ด๋‹ค. ์•ˆ๋“œ๋กœ์ด๋“œ ์ƒ๋‹จ ์‹œ์Šคํ…œ๋ฐ”์— ๋”๋ธ”ํƒญ์„ ํ•˜๋ฉด ์Šคํฌ๋กค์˜ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง„ View๋“ค์€ ์ตœ์ƒ๋‹จ์œผ๋กœ ์Šคํฌ๋กค ํ•˜๊ฒŒ ๋œ๋‹ค. ์•„์ดํฐ์˜ ์‹œ์Šคํ…œ๋ฐ” ํ„ฐ์น˜์‹œ ์ตœ์ƒ๋‹จ์œผ๋กœ ์Šคํฌ๋กค ๋˜๋Š” ๊ธฐ๋Šฅ๊ณผ ๋™์ผํ•˜๋‹ค.

์•ˆ๋“œ๋กœ์ด๋“œ ๊ฐœ๋ฐœ์ž๋“ค์€ ๊ฐ„๋‹จํ•œ ์ฝ”๋“œ๋ฅผ ํ†ตํ•ด ์ด์™€ ๊ฐ™์€ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

screens

์ž๋™์Šคํฌ๋กค ์ง€์› View

  • ScrollView
  • NestedScrollView
  • WebView
  • ListView
  • RecyclerView

์‚ฌ์šฉ๋ฒ•

  • ์•ˆ๋“œ๋กœ์ด๋“œ Manifest์— ๋‹ค์Œ๊ณผ ์œˆ๋„์šฐ ํŒ์—…์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํผ๋ฏธ์…˜์„ ์ถ”๊ฐ€ ํ•œ๋‹ค.
<uses-permission android: name = "android.permission.SYSTEM_ALERT_WINDOW" />
  • ์ž๋™ ์Šคํฌ๋กค ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ ํ•˜๊ธฐ์œ„ํ•ด ์Šคํฌ๋กค ๋˜๋Š” ๋ทฐ๋ฅผ addTargetScrollView(view)๋ฉ”์†Œ๋“œ๋กœ ์ถ”๊ฐ€ํ•˜๊ณ  removeTargetScrollView(view)๋กœ ์ œ๊ฑฐํ•œ๋‹ค. Activity๋˜๋Š” Fragment์˜ ์Šคํฌ๋กค๋ทฐ๊ฐ€ Create์™€ Destory๋˜๋Š” LifeCycle ์‹œ์ ์— ๋งž๊ฒŒ ํ˜ธ์ถœ ํ•ด์ค€๋‹ค.
@Override
protected void onCreate (Bundle savedInstanceState) {
  ย 
   super.onCreate(savedInstanceState);
   ...
   
  ย mNestedScrollView = (NestedScrollView)findViewById(R.id.scrollView);
ย   TopScrollHelper.getInstance(getApplicationContext()).addTargetScrollView(mNestedScrollView);
}

ย 

@Override
protected void onDestroy () {

   TopScrollHelper.getInstance(getApplicationContext()).removeTargetScrollView(mNestedScrollView);
ย   super.onDestroy();

}
  • ์•ˆ๋“œ๋กœ์ด๋“œ 6.0(๋งˆ์‹œ๋ฉœ๋กœ)๋ถ€ํ„ฐ๋Š” ์ง์ ‘ ํผ๋ฏธ์…˜์„ ์–ป์–ด์•ผ ํ•˜๋ฉฐ, ํผ๋ฏธ์…˜์„ ์–ป์€ ํ›„ addTargetScrollView(view)๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

Sample App Download

https://play.google.com/store/apps/details?id=com.kmshack.topscrollsample

์˜์ƒ

https://youtu.be/dlZoVnZoIVk