开发者

Android UI Not Showing

开发者 https://www.devze.com 2023-03-06 12:07 出处:网络
My splash screen for my (very simple) Android application isn\'t showing. I have no idea why. Here\'s the code:

My splash screen for my (very simple) Android application isn't showing. I have no idea why. Here's the code:

QuizSplashActivity.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);
    }
}

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>

Can someone tell me what's wrong? And don't tell me that the views aren't wrapped in a LinearLayout. They are, a LinearLayout is the root element, but I can't get the damn code formatting to work correctly for some strange reason. (It would also he开发者_JAVA百科lp if someone explains it to me)

Thanks.


It looks fine AFAIK. How are you defining @color/splash_title? Most probably you're drawing everything black. Check it by using android:background="#FFFFFFFF" in your LinearLayout.


Nevermind guys, I figured out the problem. It wasn't in the layout files, it was in the base class (QuizActivity) some problem with SharedPreferences.

0

精彩评论

暂无评论...
验证码 换一张
取 消