简体   繁体   中英

android tabwidget need help

i need to create tab in my application i've used the following working good... but i need it to display as tabs look into the iphone how it can possible it using android 1.6? thanks in advance..

<?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>

i've tried this but my application crashes

<?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>

I had customized android tab to look like iPhone UITabBar, found here:

OR you can implement your own tabs using RadioGroup but requires hell of work, to implement RadioGroup you can refer to this project . It uses Iphone like SegmentedControl , and you can use it by yourself to look like iphone tab.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM