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 6868481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:26:22+00:00 2026-05-27T03:26:22+00:00

I created a background image bitmap for a view and now the view is

  • 0

I created a background image bitmap for a view and now the view is being stretched to the size of the background image….

is this normal?

<?xml version="1.0" encoding="utf-8"?>
    <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@drawable/green"
        android:tileMode="repeat"/>

here’s how I apply it to my view

v.setBackgroundResource(R.drawable.backgroundgreen);

for instance…

if the image is 500px in height
and the view is 200px in height(being set wrap_content as height)
after setting the image as background my view becomes 500px in height…

  • 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-27T03:26:22+00:00Added an answer on May 27, 2026 at 3:26 am

    According to me, the problem you are facing is not a problem, it is the way how Android is used to design the layouts.

    This means that you can set the height and width with 3 default constant values:

    FILL_PARENT
    Special value for the height or width requested by a View. FILL_PARENT means that the View wants to be as big as its parent, minus the parent’s padding if any. This value is deprecated starting in API Level 8 and replaced by MATCH_PARENT.

    MATCH_PARENT
    Special value for the height or width requested by a View. MATCH_PARENT means that the view wants to be as big as its parent, minus the parent’s padding if any. Introduced in API Level 8.

    WRAP_CONTENT
    Special value for the height or width requested by a View. WRAP_CONTENT means that the View wants to be just large enough to fit its own internal content, taking its own padding into account.

    Now, when you are setting the View‘s height/width to WRAP_CONTENT, you are allowing the view to take that much size that is sufficient to show to view’s content. The background image is also the View‘s content, hence you view will be shown of as much size as the image. That’s not a problem, that’s how it’s shown.

    Okay, but in your situation that’s an issue for you because you have a background to show and view should not be stretched for that. I can suggest few ways:

    1. First and very obvious: make correctly sized images and keep them in different drawable folders.

    2. Specify the size of view not using constants, but in DP. If it becomes necessary, make different layout XML files for different sizes and keep them in layout folders.

    3. You can use a very useful thing for design layout is layout weight.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to create a background-image slideshow and am getting this error... This is the
Ok I have created a background image in Inkscape. Exported that image and it
As a quick explanation, I created an image that resizes to fill the background
In order to set a background image for my Desktop Flex application, I created
i'm attempting to change the background image of a custom View with some success.
I am using an Image view with these XML attributes <ImageView android:id=@+id/widget_list_bitmap android:layout_width=wrap_content android:layout_height=wrap_content
I have created a button CSS class that uses background images with different positions
I am trying to create a table with an image as a background. To
I have to create a special TextFieldUI that draws an image as the background.
Hello i am using NSOperationQueue to download images in the background. I have created

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.