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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:11:30+00:00 2026-05-25T13:11:30+00:00

I have the following drawable set as a background: <?xml version=1.0 encoding=utf-8?> <layer-list xmlns:android=http://schemas.android.com/apk/res/android>

  • 0

I have the following drawable set as a background:

<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">

<item>
  <bitmap android:src="@drawable/base_bg"
    android:gravity="bottom" />
</item>
<item android:top="10dp" android:left="10dp">
  <bitmap android:src="@drawable/decoration1"
    android:gravity="top|right" 
    android:width="25dp" 
    android:height="25dp"  />
</item>
<item android:top="10dp" android:left="10dp">
  <bitmap android:src="@drawable/decoration2"
    android:gravity="top|right" 
    android:width="25dp" 
    android:height="25dp" 
    />
</item>
</layer-list>

It displays all the bitmaps (base_bg, decoration1, and decoration2) but I can’t find a way to modify the size of them. I would like to have the main background and on top of it the decorations that will have different sizes based on the dpi. Is there a simple way to do that, or do I actually have to have a bunch of “decorations” for different dpi’s? It isn’t good and I would like to have the scale/resize option instead!

The android:width and android:height attributes are something that I would like to find, but I know that it doesn’t work. At the moment I am using different versions for different DPI but hoped it could be a bit more user friendly.

  • 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-25T13:11:30+00:00Added an answer on May 25, 2026 at 1:11 pm

    I don’t know how are these images, but, for example, you could make a big image and use it in a item android:drawable field, in this way the image takes the item’s size.

    <layer-list
    xmlns:android="http://schemas.android.com/apk/res/android">
    
    <item>
      <bitmap android:src="@drawable/base_bg"
        android:gravity="bottom" />
    </item>
    <item android:top="10dp" android:left="10dp" android:drawable="@drawable/decoration1">
    </item>
    <item android:top="10dp" android:left="10dp" android:drawable="@drawable/decoration2">
    </item>
    </layer-list>
    

    Other solutions could be to do it programmatically with LayerDrawable (here) and Drawable (here) classes. You could construct the Layer Object with 3 Drawable Objects and then choose the correct size on each Drawable object with the method setBounds(Rect ).

    I hope it helps you.

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

Sidebar

Related Questions

I have the following layout: <?xml version=1.0 encoding=utf-8?> <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical android:background=#EAEAEA>
I have the following layout: <?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> <GridView android:id=@+id/grid
I am making a custom titlebar using the following xml file: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/myTitle
I have the following View setup in one of my Activities: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/photoLayout
I have the following basic layout <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent> <LinearLayout android:orientation=horizontal android:layout_width=fill_parent
Hello i have the following xml for menu i want to set the background
I have a custom drawable in my android project that should be the background
I had a simple button set up with a background image defined like android:background=?attr/button
I have an ImageView with a source image set in the xml using the
I have the following XML. I'm trying to make a static button underneath my

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.