How to Create a curved scrollbar in android wear 2.0?

与世无争的帅哥 提交于 2019-12-06 01:45:51

问题


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?


回答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




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/43447254/how-to-create-a-curved-scrollbar-in-android-wear-2-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!