【发布时间】:2012-05-06 04:41:57
【问题描述】:
我正在查看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>
请给我建议
使用默认选项卡小部件后更新的图像
是否可以在默认选项卡视图中自定义上述单选按钮?
【问题讨论】:
-
您想知道如何在单选按钮的中心放置自定义图像,还是想知道如何使 TabView 居中?这个问题我不清楚。
-
不,我希望我的图像位于中心,仅此而已,
-
嗨@LLL,你最后能做到吗?
-
是的,我已将其标记为正确答案
标签: android