Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7074953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:07:10+00:00 2026-05-28T06:07:10+00:00

I am attempting to add a tiled image as a background of the program.

  • 0

I am attempting to add a tiled image as a background of the program.

The code that I am currently using in main.xml, which is crashing:

<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/cartoonclouds"
android:contentDescription="@string/desc" >
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />
</LinearLayout>
</ImageView>

However, when the ImageView is removed and the xmlns is moved to the LinearLayout, it functions fine (without, of course, the image).

I can’t see any related errors in LogCat.

More information:

Using Eclipse and Android 2.2, API 8. The program runs but crashes instantly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:07:11+00:00Added an answer on May 28, 2026 at 6:07 am

    You can not put anything in an ImageView. It’s not a layout. Use the background attribute of the LinearLayout to set the background to your image.

    Another option would be to wrap everything in a RelativeLayout. Separate the ImageView and the LinearLayout. The image will fill the RelativeLayout and the LinearLayout will be on top of it.

    Example:

    <?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/cartoonclouds"
        android:contentDescription="@string/desc" />
      <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        <TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="@string/hello" />
      </LinearLayout>
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to add a .click() to a tab that I add dynamically. Code
I am attempting add some tests to an existing QT GUI application using QTest.
I'm attempting to add searching support for my PHP web app using MySQL's FULLTEXT
I am attempting to add some entities that I have created. When I try
I'm attempting to add an image to a datagrid item render dynamically in flex.
I am attempting to add a note capability to my CRM that I am
Am attempting to add push notifications to an application that I have created. I
I am attempting to add BASIC authentication to a RESTful web service that I
I am attempting to add BASIC authentication to my RESTful web-service. Currently I have
I am attempting to add an image to each save button on the page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.