0

我需要在我的应用程序中创建选项卡我已经使用了以下工作良好...但我需要它显示为选项卡查看 iphone 如何使用 android 1.6 实现它?提前致谢..

<?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">
<RelativeLayout
    android:layout_height="fill_parent"
    android:layout_width="fill_parent">
    <TabWidget
        android:id="@android:id/tabs"
        android:layout_alignParentBottom="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5dp" />
</RelativeLayout>

我已经尝试过了,但我的应用程序崩溃了

<?xml version="1.0" encoding="utf-8"?>
<TabHost android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@android:id/tabhost"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TabWidget
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@android:id/tabs"
android:layout_alignParentBottom="true"
/>
 <FrameLayout
 android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@android:id/tabcontent"
 >
 </FrameLayout>
</RelativeLayout>
</TabHost>
4

1 回答 1

1

我已经自定义了 android 选项卡,看起来像 iPhone UITabBar,在这里找到:

或者您可以使用RadioGroup但需要大量工作来实现您自己的选项卡,要实现RadioGroup您可以参考这个项目。它使用 Iphone like SegmentedControl,您可以自己使用它看起来像 iphone tab。

于 2011-06-07T12:05:47.700 回答