以编程方式滚动选项卡栏(Scroll tab bar programmatically)

编程入门 行业动态 更新时间:2024-10-19 16:26:23
以编程方式滚动选项卡栏(Scroll tab bar programmatically)

我确定你知道谷歌播放,我有超过5个标签的标签栏。 所以它是可滚动的(水平),但我需要以编程方式滚动它只是20dp,以便用户在看到它时会立即注意到滚动功能。

有一个简单的方法吗?

I'm sure you know Google Play, I have tab bar with more than 5 tabs. So it's scrollable (horizontally), but i need to scroll it programatically just for 20dp so that the user will notice the scroll function as soon as he/she sees it.

is there an easy way to do that?

最满意答案

我认为这正是您正在寻找的: http : //developer.android.com/reference/android/widget/ScrollView.html#smoothScrollTo%28int,%20int%29

当您使用水平滚动时,您必须指定要移动的“x”轴。 只需调整它直到你认为它没问题。

I think this is exactly what you're looking for: http://developer.android.com/reference/android/widget/ScrollView.html#smoothScrollTo%28int,%20int%29

As you're using a Horizontal scrolling, you have to specify the 'x' axis to move. Just tune it until you think it's ok.

更多推荐

本文发布于:2023-04-29 11:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336350.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:选项卡   方式   Scroll   programmatically   bar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!