Preview: phone is there, but stays blank

Hi, I went all the way through ch 1, even to the point of seeing the app in the emulator.

But the app is blank.

But I don’t think it’s an emulator problem, because the preview never updated while coding, and always stayed blank, which I knew was weird, but thought maybe would eventually correct itself.

But now I also have a blank GeoQuiz app on my emulator.

Please help! I’ve gone through the code many times, but the messages and gradle console both show nothing is wrong.

Can you post the contents of your activity_quiz layout file?

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android

xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:orientation="vertical"
android:baselineAligned="false">

 <TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="240dp"
    android:text="@string/question_text" />

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >
    
<Button
    android:id="@+id/true_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/true_button"
    tools:ignore="ButtonStyle" />

 <Button
     android:id="@+id/false_button"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:text="@string/false_button"
     tools:ignore="ButtonStyle" />

 </LinearLayout>

Two things:

  • Remove the very large padding on your question TextView
  • Your false_button has a height of match_parent, which will make it very large

Does that help?

the first one fixed the problem. also fixed the second.

thanks.