安卓用户界面未显示



我的(非常简单的)Android应用程序的初始屏幕没有显示。我不知道为什么。代码如下:

测验飞溅活动.java

package com.ryanlin.triviaquiz;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;
public class QuizSplashActivity extends QuizActivity 
{
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
    }
}

飞溅.xml

$<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@android:color/black"
>
<TextView
    android:id="@+id/splash_textView_topTitle"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/splash_topTitle"
    android:textColor="@color/splash_title"
    android:textSize="@dimen/splash_title"
/>
<TableLayout
    android:id="@+id/splash_tableLayout"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:stretchColumns="*"
>
    <TableRow>
        <ImageView android:src="@drawable/splash1" />
        <ImageView android:src="@drawable/splash2" />
    </TableRow>
    <TableRow>
        <ImageView android:src="@drawable/splash3" />
        <ImageView android:src="@drawable/splash4" />
    </TableRow>
</TableLayout>
<TextView
    android:id="@+id/splash_textView_bottomTitle"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/splash_bottomTitle"
    android:textColor="@color/splash_title"
    android:textSize="@dimen/splash_title"
/>
<TextView
    android:id="@+id/splash_textView_version"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:text="@string/splash_version"
    android:textColor="@color/splash_version"
    android:textSize="@dimen/splash_version"
    android:background="@color/splash_versionBG"
    android:lineSpacingExtra="@dimen/splash_versionSpacing"
/>
</LinearLayout>

有人可以告诉我出了什么问题吗?不要告诉我视图没有包装在LinearLayout中。它们是,线性布局是根元素,但由于某种奇怪的原因,我无法让该死的代码格式正常工作。(如果有人向我解释也会有所帮助)

谢谢。

它看起来不错 AFAIK。您如何定义@color/splash_title?很可能你把所有东西都画成黑色。使用线性布局中的android:background="#FFFFFFFF"进行检查。

关系,伙计们,我想出了问题所在。它不在布局文件中,而是在基类(QuizActivity)中,SharedPreferences存在一些问题。

最新更新