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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:14:50+00:00 2026-06-11T19:14:50+00:00

So, the title is a little confusing, I know, but what I want is

  • 0

So, the title is a little confusing, I know, but what I want is basically a notification box that has a colored background and borders that appears on the center of the screen, but is not stretched.

I already have the custom view, making the background and borders, but if I make “width: fill_parent” and “height: wrap_content”, it will appear on the top of the screen, and if I put height to fill_parent, the entire screen will be filled with the background (which I kinda knew it would happen).

I also tried a simpler approach, setting layout_gravity to center, but didn’t help. The view is inside a vertical linear layout and it’s the only visible view within it (all the other elements have visibility = View.GONE).

How should I code the onDraw() of the custom view to be able to put height: fill_parent and have the background to obey the wrap_content rule? A simpler, better solution is always welcome as well.

  • 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-11T19:14:51+00:00Added an answer on June 11, 2026 at 7:14 pm

    I think the problem is that it’s nested in a LinearLayout.

    Try it in a FrameLayout which

    “is designed to block out an area on the screen to display a single
    item”

    You should be able to then center your custom view over a transparent background FrameLayout

    EDIT: To clarify why I think the LinearLayout is the problem. A LinearLayout fills up like a stack which is why when you tried to center by gravity the item was at the top. If you imagine a stack of plates… you can’t start in the middle 🙂

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

Sidebar

Related Questions

The title may be a little confusing, but I don't know how else to
Sorry if the title is a little weird... but basically want I want to
Hi i know the Title might sound a little confusing but im reading in
I know the title is a little confusing, but the best way to describe
the title may be a little bit confusing, but I don't know how to
I know the title is a little confusing but here is an example: String:
I know that the title might sound a little contradictory, but what I'm asking
So the title is a little confusing, I think, but here's the issue: I
I know the title is a little off, but it's hard to explain the
Alright, I know my title is a little obscure but it best describes the

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.