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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:41:38+00:00 2026-06-12T20:41:38+00:00

I have a WebView that I would like to expand to fullscreen. The user

  • 0

I have a WebView that I would like to expand to fullscreen. The user will interact with it, so it needs to maintain some sort of state when it expands. The ideal process is this:

- Remove WebView from its parent
- Put WebView at the top of the current View hierarchy with `FILL_PARENT` for width and height

Later, I will need the put the WebView back:

- Remove WebView from top of the hierarchy
- Restore the old hierarchy
- Put WebView back where it was with its previous setting for width and height

I know about getRootView, but I don’t know how to use it. What’s a DecorView?

If anyone has some sample code to accomplish the expanding and collapsing behavior I’ve described above, I’d be really grateful. Thanks!

  • 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-12T20:41:39+00:00Added an answer on June 12, 2026 at 8:41 pm

    Get the root view of the DecorView:

    ViewGroup parentViewGroup = (ViewGroup) webView.getRootView().findViewById(android.R.id.content);
    View rootview = parentViewGroup.getChildAt(0);
    

    Remove that root view:

    parentViewGroup.removeViewAt(0);
    

    Remove the WebView from its parent:

    View webViewParent = (View) webView.getParent();
    webViewParent.removeView(webView);
    

    Put the WebView at the top of the view hierarchy:

    parentViewGroup.addView(webView, 0, new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT));
    

    Use your rootview reference to undo the expansion.

    The only thing is: I don’t know how you’re going to restore the layout parameters for rootview.

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

Sidebar

Related Questions

I have a custom View that I would like to embed in an WebView.
I have a webview that shows some animated boxes, but it slows down and
I have an issue that looks like a race condition with a webview callback
I have an Android app that I would like to convert to an Android
I have a webview that has some custom HTML loaded into it. In this
I have a UIWebView that i would like to show an activity indicator in
I have one webview that fits fullscreen and loads an html file. Then another
I have a WebView wherein I would like anchor tags with rel=external to open
I have a large Png image file that I would like to display and
In my application I have a WebView and I would like to be able

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.