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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:05:14+00:00 2026-06-05T15:05:14+00:00

i have an root_layout : <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical android:background=@drawable/background android:weightSum=10> <FrameLayout android:id=@+id/parentViewHolder

  • 0

i have an root_layout :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/background"
android:weightSum="10">

    <FrameLayout
        android:id="@+id/parentViewHolder"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_weight="8"
        android:background="@android:color/transparent"
        android:cacheColorHint="@android:color/transparent" >
    </FrameLayout>

    <TextView
        android:id="@+id/spaceHolder"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:text="TEXT">
    </TextView>

Now i want, everytime i want to change the screen, that these layout is used and filled with an other declared layout.xml

I tried to use

    protected void Setup(int _layoutResourceId) 
{ 
    layoutResourceId = _layoutResourceId;
    FrameLayout holder = (FrameLayout) activity.findViewById(R.id.parentViewHolder);

    LayoutInflater layoutInflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);    
    holder.addView(layoutInflater.inflate(layoutResourceId, null, false)); 
    activity.screen = this;
}

But this didn’t work fine.Did anyone knows a nicer implementation?

  • 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-05T15:05:15+00:00Added an answer on June 5, 2026 at 3:05 pm

    If you want to add a different layout to the FrameLayout from the layout that you posted, this is how you should do it:

    protected void Setup(int _layoutResourceId) { 
        layoutResourceId = _layoutResourceId;
        FrameLayout holder = (FrameLayout) activity.findViewById(R.id.parentViewHolder);
        holder.removeAllViews();
        LayoutInflater layoutInflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);    
        layoutInflater.inflate(layoutResourceId, holder, true)); 
        activity.screen = this;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the camera app layout it has: camera.xml: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/app_root android:orientation=vertical android:layout_width=match_parent android:layout_height=match_parent>
If for example I have defined a root linear layout whose orientation is vertical:
I have android device with root and i try to implement some small app.
I have a simple problem for Android. I'd like to create an n by
I'm having the following problem; I have a LinearLayout with in it a ScrollView,
I have Radio buttons that are created dynamically. LinearLayout linLayRoot = (LinearLayout)dialogView.findViewById(R.id.dialog_layout_root); RadioGroup radGp
I have an AppWidget where the layout has a LinearLayout at the root. The
i'm making a 15 puzzle (http://en.wikipedia.org/wiki/Fifteen_puzzle) game, and i have an activity for user
I have root view with both tab bar and navigation bar visible at the
I've hired a new VPS and have root access. Now i want to configure

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.