Trying to get a background of a pizza logo on a mock pizza form.
For some reason, I keep getting an error.
Here is the layout xml:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".Short_Williams_Assignment3">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/photo"
android:id="@+id/pizzaLogo"
android:src="@drawable/pizza">
<LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/title_label"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Extra Large"
android:id="@+id/radioButton4"
android:checked="false" />
</LinearLayout>
</ImageView>
</FrameLayout>
I'm not sure why I keep getting this error. I tried wrapping the image view inside of a frame layout, but it doesnt work.
Thanks for any help you may provide!
the problem is </ImageView>
. Since ImageView can't host views you can't wrap them around it. Get rid of </ImageView>
and change from
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/photo"
android:id="@+id/pizzaLogo"
android:src="@drawable/pizza">
to
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/photo"
android:id="@+id/pizzaLogo"
android:src="@drawable/pizza" />
/>
will close the ImageView
's tag
You can't put any View inside ImageView Tag .
if you want to set that logo try using background for your linearLayout like this .
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/pizza">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/title_label"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<RadioButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Extra Large"
android:id="@+id/radioButton4"
android:checked="false" />
</LinearLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With