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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:40:21+00:00 2026-05-24T13:40:21+00:00

As an exercise, I am trying to extend ImageButton to add some features I

  • 0

As an exercise, I am trying to extend ImageButton to add some features I think would be useful. One, in particular, is a drow shadow. I’ve hit the proverbial wall with this one.

It seems to me, that a class extending BitmapDrawable is necessary. This class contains a Paint object used to draw the bitmap to the screen. If I had access to this Paint object… all I would have to do is call it’s setShadowLayer() method… but, alas, it is private. There is a public method, getPaint() that will return the paint object, but any modifications to it would be useless unless there were a corresponding setPaint() method. (There isn’t.)

Currently, my thought process looks something like the following…

  1. Create class ShadowBitmapDrawable which extends BitmapDrawable
  2. Within this class, somehow alter the BitmapDrawable‘s Paint object with Paint‘s setShadowLayer() method.
  3. In my custom ImageButton class, call setImageDrawable(Drawable d), and pass it my ShadowBitmapDrawable object.

Step 2 is the road block. What can I do to change BitmapDrawable‘s Paint object? Note that I added my thought process only as an indicator of where I am in this problem. I am open to other suggestions.

Here are some references:

  • BitmapDrawable source (extends Drawable to draw bitmaps)
  • ImageView source (base class of ImageButton)
  • Drawable source

P.S. I have a bad feeling I already know the answer I’m going to get, and I’m not going to like it. Thought I’d post the question anyways and hope for the best.

  • 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-24T13:40:22+00:00Added an answer on May 24, 2026 at 1:40 pm

    What can I do to change BitmapDrawable’s Paint object?

    Clone BitmapDrawable into your project, refactor it into your own package, make the data member protected (or provide a protected setter or something), use your modified BitmapDrawable, and test the heck out of it.

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

Sidebar

Related Questions

I was trying an exercise where I would add 1000 elements to an arraylist
I'm trying to implement some functionality of BigInteger s as a personal programming exercise.
I'm trying to exercise the principles of Dependency Injection , and I'm having some
I'm trying to create a logger for a GWT application as an exercise to
I'm trying to learn scheme via SICP. Exercise 1.3 reads as follow: Define a
I'm brand new to MVC and, as a learning exercise, I'm trying to re-write
I'm trying to do some C++ exercises, but I'm running into a error on
I'm trying to teach myself C++, and one of the traditional new language exercises
I'm trying to complete an exercise to write a program that takes the following
I'm trying (as a self-learning exercise) to create a Clojure macro that will generate

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.