我正在查看http://bakhtiyor.com/2009/10/iphonish-tabs/中发布的示例,实际上他们在这里放置了单选按钮作为 Tabview 的替代品。
但问题是,我无法将图像设置为中心。它总是与左对齐。
这是屏幕截图。我希望我的视图看起来像这样,但我希望图像位于中心。
这就是我的布局 XML 文件的外观
<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="20dip"/>
<RadioGroup android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:checkedButton="@+id/allcontacts"
android:gravity="center"
android:id="@+id/contactgroup">
<RadioButton android:id="@+id/allcontacts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:background="@drawable/button_radio"/>
<RadioButton
android:id="@+id/categories"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/button_radio"
android:orientation="vertical"
android:layout_gravity="center|right"/>
<RadioButton android:id="@+id/favourites"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:layout_weight="1"
android:background="@drawable/button_radio"/>
</RadioGroup>
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0" android:visibility="gone" />
</LinearLayout>
</TabHost>
请给我建议
使用默认选项卡小部件后更新的图像
是否可以在默认选项卡视图中自定义上述单选按钮。?