Android布局未正确显示

Android布局未正确显示,android,xml,gridview,android-layout,Android,Xml,Gridview,Android Layout,我正在编写一个android应用程序,其中我想有一个标题栏,包括游戏名称、分数等。然后在下面,我想有一个网格的图像视图,这将有点像瓷砖,我可以显示不同的字符在我的游戏 我有以下xml布局,但当我运行它时,会出现黑屏: 有人能看出我做错了什么吗 谢谢 这是无效的XML,因为没有根元素。此外,您所有的TextView小部件都有android:layout\u height=“fill\u parent”,这相当奇怪。你也可以考虑更仔细地检查你的布局,看看还有什么可能出错。 你应该在他们下面放一个

我正在编写一个android应用程序,其中我想有一个标题栏,包括游戏名称、分数等。然后在下面,我想有一个网格的图像视图,这将有点像瓷砖,我可以显示不同的字符在我的游戏

我有以下xml布局,但当我运行它时,会出现黑屏:


有人能看出我做错了什么吗


谢谢

这是无效的XML,因为没有根元素。此外,您所有的
TextView
小部件都有
android:layout\u height=“fill\u parent”
,这相当奇怪。你也可以考虑更仔细地检查你的布局,看看还有什么可能出错。

你应该在他们下面放一个(线性)布局,因为你的XML无效。

谢谢你的回答,我只是哑巴,让我的游戏循环从OnCeCATE()开始,但是我猜,直到OnCaleTe()之后,布局才被渲染。不管怎样,通过让我的班级和游戏循环a解决了这个问题Runnable@Kalypso:Correct--在将控件返回到Android之前,您的UI不会被呈现。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

    <TextView android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="@string/app_name"
            />
    <TextView android:id="@+id/score"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="@string/score"
            />
    <TextView android:id="@+id/score"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="0"
            />
    <TextView android:id="@+id/robotsLeft"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="@string/robots"
            />
    <TextView android:id="@+id/score"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="0"
            />

</LinearLayout>

<GridView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/gridview"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:columnWidth="90dp"
    android:numColumns="auto_fit"
    android:verticalSpacing="10dp"
    android:horizontalSpacing="10dp"
    android:stretchMode="columnWidth"
    android:gravity="center"
/>
super.onCreate(savedInstanceState);  
setContentView(R.layout.main);          
GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));