如何设置HorizontalScrollView以从右向左的方式运行?
默认行为是显示的第一个选项卡(默认选项卡)来自左侧.
我希望选项卡反向排序,以便第一个“默认”选项卡位于屏幕的右侧.
默认行为是显示的第一个选项卡(默认选项卡)来自左侧.
我希望选项卡反向排序,以便第一个“默认”选项卡位于屏幕的右侧.
我怎么做?
我使用layout_gravity但它不起作用..
这是我的布局代码,包含tabhost和HorizontalScrollView:
<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);
这个想法是程序化滚动需要延迟才能工作.