简体   繁体   中英

how to set title and height to tab host in android?

I have a question that I am implementing a tab in my android app but Tab host not displays title.

I use the following code in XML

    <TabWidget
        android:id="@android:id/tabs"
        android:layout_width="fill_parent"
        android:layout_height="63dip"/>

    <FrameLayout
        android:id="@android:id/tabcontent"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>
</LinearLayout>

Please tell how to display title and set the size to tab host in android

I recommend you look here.

Basically, you create a custom layout(This is all from that link BTW):

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient android:startColor="#A8A8A8" android:centerColor="#7F7F7F"
        android:endColor="#696969" android:angle="-90" />
</shape>

Then you inflate it. Since I don't want to do straight-up plagiarism, just check the link.

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