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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:21:56+00:00 2026-05-31T19:21:56+00:00

After two years of Android development I’m still not 100% sure about what resources

  • 0

After two years of Android development I’m still not 100% sure about what resources I need to provide to make my GridView work on different size and resolution devices.

I’m still learning, for example I recently discovered that you don’t have to supply every drawable in all screen sizes – if you put something in xhdpi then Android is clever enough to resize that on the fly most of the time – but there are a few few quirks. For example if I try using drawables which are only defined in the drawable-xhdpi bin on a mdpi device in a GridView, the drawable will visually resize correctly but the whitespace around it won’t – that will still be the original size. Originally I got around this by forcably defining dimensions for all aspects of the GridView and the associated adapter view, but this had a load of code smell around it, so I resized the drawables manually, put them in their respective bins (drawable-mdpi, drawable-hdpi and drawable-xhdpi) and removed all the forcing of image sizes etc.

So I currently have:

    <GridView
        android:id="@id/home_image_grid"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:columnWidth="100dp"
        android:gravity="center"
        android:listSelector="#00000000"
        android:numColumns="auto_fit"
        android:stretchMode="columnWidth"
    >
    </GridView>

and the layout for each item is:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_margin="0dip"
          android:gravity="center"
          android:orientation="vertical"
          android:padding="0dip">

    <ImageView
            android:id="@id/home_button_image"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
        />

        <TextView
            android:id="@id/home_button_text"
            android:layout_width="wrap_content"     
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textColor="@color/default_text_colour"
            android:textSize="@dimen/home_button_text"
             />

    </LinearLayout>

So far so good…

The app I’m currently working on I’ve almost finished and have been doing some testing on different devices – it looks good on normal screen size xhdpi, hdpi & mdpi devices. Then I extending my testing to other devices – I’m testing on an HTC Flyer which is large screen size, mdpi – and the gridview now looks rubbish – it’s correctly picking up the mdpi images, which are tiny.

Doing some reading around I found the GridView tutorial GridView tutorial, which says to put all your drawables in the ‘drawable’ bin, so I followed this advice and again everything looked rubbish – on closer inspection (and having actually read through the example code) it seems that they are manually setting the size of each image in the GridView – which I’d been doing to start off with, and which means that I’m going to have to manually set the image sizes for every permutation of devices.

So..I’m left wondering if I’ve missed a trick here – should I take my first approach of sticking the images in my drawable folder and manually forcing the sizes for every purmutation? Should I draw a new set of images for all permutations of screen size and resolution?

How can I guarantee that whatever I do, it’s going to look good on a device I’ve not tested it on?

Either way it feels like I’m doing something wrong – but I can’t work out how to do this properly without loads of hassle. Can anyone help?

  • 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-31T19:21:57+00:00Added an answer on May 31, 2026 at 7:21 pm

    I’m not sure what you mean by “forcing the sizes for every permutation” but you could put the proper sized drawables in the following folders:

    • drawable-mdpi
    • drawable-large-mdpi

    Each device would pick the right drawables from the corresponding folder and you could separate normal and large images for mdpi devices.

    Wouldn’t that fix your problem?

    P.S: The drawable folder is meant for XML drawables only or photos which do not depend on the device’s density, not images for the UI. Those will scale properly for each resolution and density.

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

Sidebar

Related Questions

I'm taking the plunge into iPhone development after about two years working with django.
I have once again fleshed out Ruby, after two years of not touching it,
Yesterday, after about two years we re-deployed our application. Code hasn't changed, but the
After developing ASP.NET apps exclusively for several years I'm about to start developing Winforms
After almost two years of using DVCS, it seems that one inherent flaw is
Alright, I'm not the best with JOIN's and after all these years of working
After two years of C#, my VB.NET is a bit rusty. I have two
It's been at least two years since I've coded in objective-c, and after pulling
I've been running nagios for about two years, but recently this problem started appearing
I'm used to visit a web site (news website) frequently. after two years of

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.