【发布时间】:2014-04-16 09:55:38
【问题描述】:
我创建了一个 FragmentTabHost 并且它工作正常,但我想将选项卡的重力设置为正确。我使用了这段代码,但它不起作用:
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
params.gravity = Gravity.RIGHT;
mTabHost.getTabWidget().setLayoutParams(params);
我的 XML 布局文件如下:
<android.support.v4.app.FragmentTabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TabWidget
android:id="@android:id/tabs"
android:gravity="right"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</android.support.v4.app.FragmentTabHost>
任何建议将不胜感激!
【问题讨论】:
标签: android gravity tabwidget fragment-tab-host