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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:26:48+00:00 2026-05-18T04:26:48+00:00

How do you display different images for different screen resolutions (hdpi, ldpi, mdpi) in

  • 0

How do you display different images for different screen resolutions (hdpi, ldpi, mdpi) in an embedded HTML resource of an Android app?

The HTML resource is located in assets, but can be changed if necessary.

If this is not possible, how do you change the display size of the image based on the screen resolution?

  • 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-18T04:26:49+00:00Added an answer on May 18, 2026 at 4:26 am

    I managed to do this with @media queries and -webkit-device-pixel-ratio. While the images have to be located in assets, you can use folders to organize them properly.

    @media screen and (-webkit-device-pixel-ratio:0.75) {
        #header {
            background-image: url('ldpi/background.png');
            width: 75px;
            height: 75px;
        }
    }
    
    @media screen and (-webkit-device-pixel-ratio:1.0) {
        #header {
            background-image: url('mdpi/background.png');
            width: 100px;
            height: 100px;
        }
    }
    
    @media screen and (-webkit-device-pixel-ratio:1.5) {
        #header {
            background-image: url('hdpi/background.png');
            width: 150px;
            height: 150px;
        }
    }
    

    According to the documentation (Building web pages to support different screen densities), this only works in Android 2.0 or higher.

    You never know enough CSS, it seems.

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

Sidebar

Related Questions

In my iPhone app, I am using a single tableview to display different sets
I have the following drawable folders /drawable/ /drawable-hdpi/ /drawable-ldpi/ /drawable-mdpi/ /drawable-xhdpi/ If I have
My android app currently has two layouts for its splash screen, portrait and landscape.
I am looking for an optimized solution to display image in different screen size.
I wrote a program in Android for setting different kinds of images as my
I'm want to display different image version: first article: big banner second: small banner
I want to display different types of objects in the same ajax called controller
I want to display different forms in change_form depending on some model field's values.
I am using this code in wordpress to display different content when different pages
I would like to have my canvas page on facebook display different content for

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.