user1196985
user1196985

Reputation: 120

error in creating menu.xml of Game Menu

I am designing game menu,I am taking reference of http://p-xr.com/android-tutorial-game-menu-with-a-custom-font/comment-page-1/#comment-857

My main.xml file currently contains:

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

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"> 


<ImageView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:src="@drawable/wallpaper1" />

    <LinearLayout
        android:orientation="vertical"
        android:layout_margin="10dp"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <TextView
            android:text="START GAME"
            android:layout_gravity="right"
            android:id="@+id/start"/>

        <TextView
            android:text="QUICK GAME"
            android:id="@+id/quick"/>

        <TextView
            android:text="SETTINGS"
            android:id="@+id/settings"/>

        <TextView
            android:text="ABOUT"
            android:id="@+id/about"/> 

        <TextView
            android:text="EXIT"
            android:id="@+id/exit"/>

    </LinearLayout>
</RelativeLayout>

However there seems to be an error error, which I do not understand, in graphical layout which says: "You must specify layout_height and layout_width".

Upvotes: 0

Views: 279

Answers (1)

Sly
Sly

Reputation: 2101

AFAIK, attributes android:layout_width and android:layout_height are mandatory for each view declared in a XML layout file.

Just define them for each TextView element.

Upvotes: 1

Related Questions