7

android wear 2.0

I am using WearableRecyclerView to create a curved layout,but the default scrollbar is still vertical.Is there a way to create a curved scrollbar like android wear 2.0 launcher?

Ichigo Kurosaki
  • 3,765
  • 8
  • 41
  • 56
fang jack
  • 71
  • 1
  • 2

3 Answers3

3

Actually, the scrollbars are circular for any scrollable View that takes up the whole screen. It's a framework feature for Wear 2.0.

If the scrollbars are still vertical, make sure your View really does fill up the whole screen - set it to match_parent and as a top level root View.

  • 1
    This worked for me, view doesnt need to be root view but needs to fill entire view port (i had margin top set which breaks the scroll). Ridiculous that this isnt documented anywhere – ScruffyFox Apr 24 '19 at 13:50
1

use boxinsetlayout

// android.support.wearable.view.BoxInsetLayout

app:layout_box="left|bottom|right"

...Your list View and other contents

android.support.wearable.view.BoxInsetLayout>

and if you are using wearableRecyclerView do CircularChildLayoutManager mChildLayoutManager = new CircularChildLayoutManager(mContext); and set this as layout manager for your recycler view.

mRecyclerView.setLayoutManager(mChildLayoutManager);

This may solve for you.

Apurv Mahesh
  • 129
  • 4
1

The API was renamed to CurvedChildLayoutManager

So use

val layoutManager = CurvedChildLayoutManager(this)
recyclerView.layoutManager = layoutManager

PS: as for topic question, you dont need app:layout_box just use android:scrollbars="vertical" on your WearableRecyclerView

https://developer.android.com/reference/android/support/wearable/view/CurvedChildLayoutManager.html

deviant
  • 3,539
  • 4
  • 32
  • 47
  • I cannot resolve CurvedChildLayoutManager class, do you know why? my dependency is dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.support:wearable:2.0.0' compile 'com.google.android.gms:play-services-wearable:10.2.1' provided 'com.google.android.wearable:wearable:2.0.0' } – fang jack May 09 '17 at 09:20
  • @fangjack try 2.0.1 – deviant May 10 '17 at 05:32
  • 1
    I change to 2.0.1,the CurvedChildLayoutManager was imported.But using CurvedChildLayoutManager doesn't work as i expected,the scrollbar is still vertical,and not curved. – fang jack May 10 '17 at 08:44
  • same for me, the scrollbar is still vertical! – romaneso Jun 15 '17 at 21:05
  • Unfortunately this answer is deprecated – NiklasLehnfeld Oct 05 '20 at 13:43