简体   繁体   English

Wear OS 中的分页

[英]Pagination in Wear OS

Good Morning, I'm developing a new Wear OS application.早上好,我正在开发一个新的 Wear OS 应用程序。 The thing is, I can't find anywhere how to make a good pagination .问题是,我在任何地方都找不到如何制作好的分页
I would like to change activity on swipe (no matter if it's vertical or horizontal) but can't find anywhere how to do it...我想更改滑动时的活动(无论是垂直的还是水平的),但在任何地方都找不到如何做到这一点......
Maybe I should not navigate in my app like that ?也许我不应该那样在我的应用程序中导航? Can you help me if you have any answer on how to do it ?如果您对如何做有任何答案,您能帮我吗?
thanks !谢谢 ! (for some reasons I can't say hello on my post ?) (由于某些原因,我不能在我的帖子上打招呼?)

You can use HorizontalPager or VerticalPager from Accompanist.您可以使用 Accompanist 的 Horizo​​ntalPager 或 VerticalPager。

https://google.github.io/accompanist/pager/ https://google.github.io/accompanist/pager/

                HorizontalPager(
                    modifier = Modifier.fillMaxSize(),
                    count = 10,
                    state = state
                ) { page ->
                        Box(
                            modifier = Modifier.fillMaxSize(),
                            contentAlignment = Alignment.Center
                        ) {
                            Text(text = "Screen $page")
                        }
                    }
                

An example https://github.com/google/horologist/blob/e2741cef87774b18d58bb1b0f78bd5b60901f20d/sample/src/main/java/com/google/android/horologist/scratch/ScratchActivity.kt#L79一个例子https://github.com/google/horologist/blob/e2741cef87774b18d58bb1b0f78bd5b60901f20d/sample/src/main/java/com/google/android/horologist/scratch/ScratchActivity.kt#L79

If you want something more custom, then it's probably a serious investment in a component.如果您想要更多定制的东西,那么它可能是对组件的重大投资。 Especially if it needs to work with the system Swipe to Dismiss.特别是如果它需要与系统一起使用滑动以关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM