如何设置android Horizo​​ntalScrollView从右到左的行为(默认选中的选项卡从右侧,而不是左侧)

如何设置android Horizo​​ntalScrollView从右到左的行为(默认选中的选项卡从右侧,而不是左侧),第1张

概述如何设置Horizo​​ntalScrollView以从右向左的方式运行? 默认行为是显示的第一个选项卡(默认选项卡)来自左侧. 我希望选项卡反向排序,以便第一个“默认”选项卡位于屏幕的右侧. 我怎么做? 我使用layout_gravity但它不起作用.. 这是我的布局代码,包含tabhost和Horizo​​ntalScrollView: <TabHost xmlns:android="http 如何设置Horizo​​ntalScrollVIEw以从右向左的方式运行?
默认行为是显示的第一个选项卡(默认选项卡)来自左侧.
我希望选项卡反向排序,以便第一个“默认”选项卡位于屏幕的右侧.

我怎么做?
我使用layout_gravity但它不起作用..

这是我的布局代码,包含tabhost和Horizo​​ntalScrollVIEw:

<TabHost xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:ID="@androID:ID/tabhost"androID:layout_wIDth="fill_parent"androID:layout_height="fill_parent" ><linearLayout    androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent"    androID:orIEntation="vertical" >    <horizontalscrollview        androID:layout_wIDth="fill_parent"        androID:layout_height="wrap_content"        androID:fillVIEwport="true"        androID:scrollbars="none">        <TabWidget            androID:ID="@androID:ID/tabs"            androID:layout_wIDth="fill_parent"            androID:layout_height="wrap_content" />    </horizontalscrollview>    <FrameLayout        androID:ID="@androID:ID/tabcontent"        androID:layout_wIDth="fill_parent"        androID:layout_height="fill_parent" /></linearLayout></TabHost>
解决方法 一个有效的解决方法:

final horizontalscrollview vIEw = (horizontalscrollview) findVIEwByID(R.ID.scroller);        vIEw.postDelayed(new Runnable() {            @OverrIDe            public voID run() {                vIEw.fullScroll(horizontalscrollview.FOCUS_RIGHT);            }        },10);

这个想法是程序化滚动需要延迟才能工作.

总结

以上是内存溢出为你收集整理的如何设置android Horizo​​ntalScrollView从右到左的行为(默认选中的选项卡从右侧,而不是左侧)全部内容,希望文章能够帮你解决如何设置android Horizo​​ntalScrollView从右到左的行为(默认选中的选项卡从右侧,而不是左侧)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1126765.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-30
下一篇2022-05-30

发表评论

登录后才能评论

评论列表(0条)

    保存