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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:13:48+00:00 2026-05-18T22:13:48+00:00

This seems like a dumb question, but I couldn’t see any way to do

  • 0

This seems like a dumb question, but I couldn’t see any way to do this using methods in the Drawable class. Then I thought maybe I’d have to flip the Canvas in some way.. still couldn’t find a suitable method.

I just need to “flip” a Drawable on it’s y-axis.. the center y preferably. How can I do this?

  • 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-18T22:13:48+00:00Added an answer on May 18, 2026 at 10:13 pm

    From a 10k ft level, you want to create a new bitmap and specify a transform matrix to flip the bitmap.

    This may be a bit overkill, but here is a small sample application that illustrates how to do this. As written, the transform matrix prescale of (-1.0f, 1.0f) flips the image in the x direction, a prescale of (1.0f, -1.0f) would flip it in the y direction.

    public class flip extends Activity{
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            //Set view to our created view
            setContentView(new drawView(this));
        }
    
        private class drawView extends View{
            public drawView(Context context){
                super(context);
            }
    
            @Override
            protected void onDraw(Canvas canvas) {
                super.onDraw(canvas);
    
                //Load the jellyfish drawable
                Bitmap sprite = BitmapFactory.decodeResource(this.getResources(), R.drawable.jellyfish);
    
                //Create a matrix to be used to transform the bitmap
                Matrix mirrorMatrix = new Matrix();
    
                //Set the matrix to mirror the image in the x direction
                mirrorMatrix.preScale(-1.0f, 1.0f);
    
                //Create a flipped sprite using the transform matrix and the original sprite
                Bitmap fSprite = Bitmap.createBitmap(sprite, 0, 0, sprite.getWidth(), sprite.getHeight(), mirrorMatrix, false);
    
                //Draw the first sprite
                canvas.drawBitmap(sprite, 0, 0, null);
    
                //Draw the second sprite 5 pixels to the right of the 1st sprite
                canvas.drawBitmap(fSprite, sprite.getWidth() + 5, 0, null);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if this seems like a dumb question but I am just learning bash
This may be a dumb question but it seems like activateIgnoringOtherApps: may be the
Seems like this is a dumb question, but I need something... substantial. I have
I know this seems like a dumb question but how do I search a
Ok this seems like a dumb question and probably is but I cannot figure
This seems like an incredibly dumb question to have to ask, but how do
This seems like a repeated question but i'm not able to get my answer.
This seems like the simplest Git question, but I can't find ANYTHING on it.
This may seem like a dumb question, but can an app build with c#
This might seem like a really dumb question, but I am writing an application

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.