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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:47:46+00:00 2026-06-14T09:47:46+00:00

So, I’m trying to view a camera preview as a background with an imageview

  • 0

So, I’m trying to view a camera preview as a background with an imageview on top of it. Check this question out, that I’ve asked, to get a better idea of what I’m trying to accomplish. However, instead of using a FrameLayout, I found it easier to use a RelativeLayout (for the reason of placing views where I want on the screen). The problem is that I can’t get the imageview (over the surface view) to take up the whole screen. No matter how I re-size the image it still displays in the center without filling the screen.

So, my question is, how would I make the imageview fill the entire screen over the surface view? Perhaps, I am making a simple mistake but if that is the case please point it out. Any help will be greatly appreciated! Thanks!

Here’s the XML file:

<?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"
android:id="@+id/relative" >

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/image"
    android:src="@drawable/background" >
</ImageView>

<Button
    android:id="@+id/scan"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_margin="10dp"
    android:text="Scan"
    android:textSize="20dp"
    android:textStyle="bold"
    android:onClick="Scan" />

<Button
    android:id="@+id/search"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/scan"
    android:layout_centerHorizontal="true"
    android:layout_margin="10dp"
    android:text="Search"
    android:textSize="20dp"
    android:textStyle="bold"
    android:onClick="Search" />

<Button
    android:id="@+id/importing"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/search"
    android:layout_centerHorizontal="true"
    android:layout_margin="10dp"
    android:text="Import"
    android:textSize="20dp"
    android:textStyle="bold"
    android:onClick="Import" />

</RelativeLayout>

And here’s the code where I place the views (bring to front so they are visible over the surface view):

    mPreview = new CameraPreview(this, mCamera);
    relative.addView(mPreview);
    layout.bringToFront();
    scan.bringToFront();
    search.bringToFront();
    friendImport.bringToFront();

EDIT:
Here’s an example image of what I’m talking about (I am trying to get the white transparent image to cover the whole screen):

image not displaying full screen

  • 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-06-14T09:47:47+00:00Added an answer on June 14, 2026 at 9:47 am

    After experimenting for a while, I seem to have found a solution to my problem. My image was showing up similar to this picture:

    9 patch description

    Which is weird, because this is how a 9-patch image works and I did not declare my image as a 9-patch. But even when I called match_parent (or even fill_parent) it only filled to the fill area like in the image I posted.

    So, with lots of trial and error, I took away any border that was on the image and took all the blur effects off. The image was, for some reason, a dramatically smaller file size. Then, I tried to place this as the background and… success!

    I’m not too sure as to why it did not work to begin with, but, I have a theory that, perhaps, because there was a 1px border on the image it saved it as a 9-patch PNG instead of a normal PNG file. Or maybe it was due to the blur effect that was on the image. I’m not too sure, but, I do know that once I took off the blur effects and removed the border it did work.

    I hope this is useful for anyone who might be faced with a similar problem!

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
This could be a duplicate question, but I have no idea what search terms
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.