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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:04:53+00:00 2026-06-07T11:04:53+00:00

I have an app widget and in it I’d like to show a scaled

  • 0

I have an app widget and in it I’d like to show a scaled down version of my app’s icon in the bottom right. The image’s dimensions are 36×36 and the image looks fine at those dimensions, but I’d like the image to be smaller, around 18×18. However, if I resize the image in a image editor or try to scale the image in code, the image appears distorted.

This is what the image looks normally:

enter image description here

This is the image scaled:

enter image description here

This is the ImageView code I’m using:

<ImageView 
   android:id="@+id/widgetIcon"
   android:src="@drawable/icon"
   android:layout_width="18dp"
   android:layout_height="18dp"
   android:layout_alignParentRight="true"
   android:layout_centerVertical="true"
   android:scaleType="centerCrop"
 />

UPDATE:

I actually have the image in different drawable folders, broken out like this:

drawable-ldpi: 36×36

drawable-mdpi: 48×48

drawable-hdpi: 72×72

drawable-xdpi: 96×96

The device I took the screenshots in is a Galaxy Nexus.

UPDATE 2:

Here is the entire layout that the ImageView is in, if that makes a difference. The widget has RelativeLayout at the bottom that hold the ImageView.

<?xml version="1.0" encoding="utf-8"?>

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/widgetLayout"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:padding="@dimen/widget_margin">

    <RelativeLayout
        android:id="@+id/widgetBgLayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:paddingTop="10dp"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:background="@drawable/bg_widget"
         >

        <RelativeLayout
            android:id="@+id/widgetStatusLayout" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:layout_alignParentBottom="true"
            android:paddingTop="10dp"
          >
                <TextView 
                    android:id="@+id/widgetStatus" 
                    style="@style/WidgetStatus"
                    android:layout_centerVertical="true"
                    android:layout_alignParentLeft="true" 
                />

                <ImageView 
                   android:id="@+id/widgetIcon"
                   android:src="@drawable/icon"
                   android:layout_width="18dp"
                   android:layout_height="18dp"
                   android:layout_alignParentRight="true"
                   android:layout_centerVertical="true"
                   android:scaleType="centerInside"
                   android:adjustViewBounds="true"
                 />

            </RelativeLayout>
            <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:layout_above="@id/widgetStatusLayout"       
                    android:layout_alignParentTop="true"
             >      
                    <TextView 
                        android:id="@+id/widgetTitle" 
                        style="@style/WidgetTitle"
                    />

                    <TextView 
                        android:id="@+id/widgetText" 
                        style="@style/WidgetText"
                    />
            </LinearLayout>
    </RelativeLayout>

</FrameLayout>

UPDATE 3

The issue isn’t with the image scaling, it’s the layout above the image is overlapping. Not sure of a solution though.

  • 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-06-07T11:04:56+00:00Added an answer on June 7, 2026 at 11:04 am

    You should put the image into each of the different drawable folders (hdpi, ldpi, mdpi, xhdpi). This should help. Also, change the android:scaleType to fitCenter.

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

Sidebar

Related Questions

i have an app widget, which contains only one imageview. i redraw that image
Since Android does not directly have icon badges I would like to use app
I have created an App Widget for Android 1.5. It uses a TextView to
I have 1 android app project and 1 widget project, they all work fine.
I have a widget that is a part of my main app. Usually when
I have a JavaScript widget which communicates with my Rails app by creating tags
I have a widget that supposed to call an Activity of the main app
I have an appwidget and I want to show other installed applications' launcher icon
I would like to have an AppWidget that designed like this one . Image:
I have an app widget which runs neatly. However, I am unable to highlight

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.