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

  • Home
  • SEARCH
  • 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 3428244
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:56:08+00:00 2026-05-18T06:56:08+00:00

this problem has been bothering me for days and I cannot figure out why

  • 0

this problem has been bothering me for days and I cannot figure out why on earth it is happening. I have a method that detects for a face, if a face is detected, the method will draw a rectangle on a canvas along the face.

That part works fine.

The problem is, when it displays to the image_view in my xml file, it will display on the far left middle of the image view, in a box, rather than in the center with the width as fill_parent.

I thought of a possible workaround : to set the bitmap as a bitmapdrawable, but canvas only draws to bitmaps, so I can get the bitmapdrawable in the middle, but with no red box around it.

I commented out my testing of bitmap drawable, and left it as what I have now…it only displays to my xml in the far left of the image_view. Please take a look and help!

I posted to pastebin because the code is a bit long (I am also using a linear layout within a view flipper).

method:

http://pastebin.com/KQ5Pmx45

xml:

http://pastebin.com/jbt3j40h

Since I am able to get the faces to detect, and I can paste a bitmap drawable to an imagebutton and it centers just fine, is there a way to get the rectangle around the bitmapdrawable if my problem cannot be solved?

Thanks!

EDIT: I tried to implement it into a RelativeLayout and still doing the same thing:

http://pastebin.com/daqMdXjB

Could this code be getting my way of centering?

    public void processCameraImage(Intent intent) {
        mFlipper.setDisplayedChild(1); // 1 == your second layout
        mThePicture = (ImageView) findViewById(R.id.image_view); //
        cameraBitmap = (Bitmap) intent.getExtras().get("data");

        mThePicture.setImageBitmap(cameraBitmap);
        detectFaces();

    }
  • 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-18T06:56:09+00:00Added an answer on May 18, 2026 at 6:56 am

    Use on Imageview tag android:scaleType=”fitCenter” or android:scaleType=”centerInside” or android:scaleType=”center” sclaetype attr doc

    I hope, I understood your problem right.

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

Sidebar

Related Questions

This has been a problem that I haven't been able to figure out for
This problem has been kicking my butt for a few days now. I have
Has anyone else run into this problem before? I've got a method that calls
This problem has been solved thanks to your suggestions. See the bottom for details.
I'm sure this problem has been solved before and I'm curious how its done.
A coworker has been struggling with this problem. The desired result is an installable
I know this question has been asked before, but I ran into a problem.
Has anyone run into this problem... In my layout.phtml I have: <head> <?= $this->headTitle('Control
A coworker of mine has this problem, apparently after installing Re#, which seems totally
Uhm I'm not sure if anyone has encountered this problem a brief description is

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.