小编Gid*_*ido的帖子

Android tabHost是不可见的?为什么不用这个XML显示?

在Eclipse上的XML编辑器中,我看到了tabhost,它看起来就像我想要的那样,但是当我运行它时,我根本看不到tabHost,我怎样才能确保它是可见的?

这是我的XML.再次,编辑器显示它,但是当我运行它时它没有,膨胀它的活动还没有做太多,只需更改两个文本字段.有任何想法吗?

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:columnCount="2"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/name"
        android:layout_width="238dp"
        android:layout_column="0"
        android:layout_columnSpan="2"
        android:layout_gravity="top|left"
        android:layout_marginTop="7dp"
        android:layout_marginLeft="3dp"
        android:layout_row="0"
        android:gravity="top"
        android:maxLines="1"
        android:padding="3dp"
        android:text="Motherfucking Acer Laptop X314134"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <View
        android:layout_height="2dp"
        android:layout_width="fill_parent"
        android:layout_row="1"
        android:layout_column="0"
        android:layout_columnSpan="2"
        android:background="#FF000000"
        />

    <TabHost
        android:id="@android:id/tabhost"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_column="0"
        android:layout_columnSpan="2"
        android:layout_gravity="center_horizontal"
        android:layout_row="2" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" >
            </TabWidget>

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

                <LinearLayout
                    android:id="@+id/Info"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/Specs"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/Fotos"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" > …
Run Code Online (Sandbox Code Playgroud)

xml tabs android tabwidget android-tabhost

3
推荐指数
1
解决办法
3363
查看次数

标签 统计

android ×1

android-tabhost ×1

tabs ×1

tabwidget ×1

xml ×1