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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T11:15:33+00:00 2026-06-02T11:15:33+00:00

I have created one simple UI and set by id mainContainer2. i want to

  • 0

I have created one simple UI and set by id mainContainer2.
i want to know if something like this is possible to reuse it inside a loop for example

<LinearLayout
    android:id="@+id/mainContainer2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Large Text"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:src="@drawable/ic_launcher" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium" />
    </LinearLayout>

    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />
</LinearLayout>

LinearLayout mainContainer = new LinearLayout(this);
mainContainer.setOrientation(LinearLayout.VERTICAL);

TextView textoqualquer = new TextView(this);
textoqualquer.setText("textoqualquer");
mainContainer.addView(textoqualquer);

LinearLayout maincontainer = new LinearLayout(this);
maincontainer.setOrientation(LinearLayout.VERTICAL);
maincontainer.findViewById(R.id.mainContainer2);



mainContainer.addView(maincontainer);

setContentView(mainContainer);
  • 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-02T11:15:35+00:00Added an answer on June 2, 2026 at 11:15 am

    Im not sure what you are asking. But you can use the same xml ui wherever need by just inflating it like

    LayoutInflater mInflater = LayoutInflater.from(context);
    LinearLayout yourLayout = (LinearLayout)mInflater.inflate(R.layout.your_layout, null);
    

    Then you can use the layout where ever needed.
    Also in xml file you can reuse another xml layout by using either the ‘include’ or ‘merge’ tag
    like

    <include layout="@layout/okcancelbar_button"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a bit confused. I have created a simple form with a one
I have created one listview, in this each row contain check box and the
I have a two simple IceFaces buttons created this way. (I don't use xhtml
I have created a simple RAII class in one of my DLLs (let's call
I have created a very simple model called Discussion and one of the columns
I have created two actions in code, one simple and one advanced. function userbeep_action_info()
I'm trying to create a simple, custom, gallery. I have two lists, one with
I have created one preference page where there are stringfieldeditor. Whenever user give some
I have created one table using the below command: create table Table1( Id int
I have created one aspx Page from that i need to access the property

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.