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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:12:10+00:00 2026-05-31T05:12:10+00:00

I’m having trouble declaring my bitmap/drawable in appropriate xml According to convoluted android docs,

  • 0

I’m having trouble declaring my bitmap/drawable in appropriate xml
According to “convoluted” android docs, you can declare drawables a dozen ways such

<?xml version="1.0" encoding="utf-8"?>
<ImageView
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:src="@drawable/myimage" />

OR

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

OR , etc…

Belows are 2 examples of the dozen drawables.xml that I have tried without success.
Example 1:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <item xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/enemyAirplane1" android:drawable="@drawable/enemyAirplane1" >
<bitmap  android:src="@drawable/enemyAirplane1" />  
 </item>
  <item xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/playerShape1" android:drawable="@drawable/playerShape1">
<bitmap  android:src="@drawable/playerShape1" />  
 </item>
</resources>

Example 2:

<?xml version="1.0" encoding="UTF-8"?>
<resources>
<bitmap  android:src="@drawable/enemyAirplane1" />  
 <bitmap  android:src="@drawable/playerShape1" />  
</resources>

Finally my exact questions are:
1) What should be the name of xml that declares drawable/bitmap resources (drawables.xml) or ?
2) Were should the xml file reside/in which resource folder (res/values) OR ?
3) Can someone provide a working example of bitmap declared in xml , without any xml or IDE errors?

  • 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-31T05:12:10+00:00Added an answer on May 31, 2026 at 5:12 am

    If you have a bitmap file (.png, .jpg, or .gif), you may place it in res/drawable/ (or any annotated version of res/drawable/ such as res/drawable-hdpi) and refer to it in your layout files as in your first code snippet. That snippet will look in res/drawable for one of four possibilities : myimage.png, myimage.jpg, myimage.gif, or myimage.xml. Bitmaps declared in xml files also must refer to a resource of .png, .jpg, or .gif. The declaration in an xml file is for creating an alias and/or specifying additional properties such as dithering.

    To answer your specific questions:

    1. You don’t have to create an xml file to declare drawable
      resources. You just drop your files in the res/drawable/ folder.
    2. As explained above, there is no xml file needed to declare drawable
      resources.
    3. Many Android example projects contain drawable
      resources. Snake is a simple example.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble declaring a const field in an abstract class. Why is this?
Having trouble finding an explanation in the docs, would someone be kind enough to
I'm having trouble getting my head around declaring functions dynamically. I tried to ask
Having trouble with pattern and replacement. How can I make the replacement echo a
I'm having trouble with declaring 2-dimensional arrays in C#, populating them and then returning
I'm having some trouble in declaring a STL Set of pointers to class instances.
I'm having trouble with running a bare example. I'm using this to declare a
I'm having trouble declaring a template class. I've tried an number of ill-readable and
I'm trying to use the boost unordered_multimap class and I'm having trouble declaring it.
I'm having trouble declaring a C Array as an Objective-C Property (You know @property,

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.