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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:31:56+00:00 2026-05-24T04:31:56+00:00

I want to add multiple View in a LinearLayout . Here is the code

  • 0

I want to add multiple View in a LinearLayout. Here is the code I am using for add adding multiple view to the LinearLayout.

Java code:

LinearLayout seriesMainListItemView = (LinearLayout) findViewById(R.id.SeriesMainListItemView);
                LayoutInflater mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

                for (int i=0; i<scheduleArr.length; i++) {

                      View inflatedView = mInflater.inflate(R.layout.scheduleitem, null);
                      TextView inflatertext1 = (TextView) inflatedView.findViewById(R.id.text1);
                      TextView inflatertext2 = (TextView) inflatedView.findViewById(R.id.text2);
                      inflatertext1.setText(scheduleArr[i][0]);
                      inflatertext2.setText(scheduleArr[i][1]);
                      Log.i("data",i + " " + scheduleArr[i][0] + "/" + scheduleArr[i][1]);
                      seriesMainListItemView.addView(inflatedView);
                }

Here is the View xml I want to add multiple times.

Here is the LinearLayout where I want to add it.

<TableLayout
                android:layout_gravity="center_vertical" 
                android:layout_width="fill_parent" 
                android:layout_height="fill_parent"
                android:paddingLeft="1dip"
                android:paddingRight="1dip" >
                 <TableRow
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent">
                    <ImageView
                       android:id="@+id/imgSeriesMainScheduleImg"
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
                       android:layout_gravity="center"
                       android:background="@drawable/scheduleheader"/> 
                    <LinearLayout  
                        android:id="@+id/SeriesMainListItemView"                                    
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent">
                    </LinearLayout>                                                                                              
                </TableRow>
..............
</TableLayout>

But only single view is adding in the LinearLayout, although length of the array is 3. What is the problem in my code?

  • 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-05-24T04:31:56+00:00Added an answer on May 24, 2026 at 4:31 am

    I have add the orientation of LinearLayout as Vertical. And it become perfect. Thank you Sujit for your hints.

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

Sidebar

Related Questions

I want to programmatically add multiple UIButtons to a view - the number of
I want to add same field to multiple tables. Can I do this with
I want to add a specific behavior to multiple forms. In this case its
I have viewport3D and I want to add multiple 3d objects defined in xaml
I don't think this is possible but here goes... I want to add method
I have two g:select comboboxes that I want to add to the multiple select
I have dbml with single table users i want add partial class for User
I want to add a column to an existing legacy database and write a
I want to add a constant value onto an incoming bound integer. In fact
I want to add a scheduled task to a client's ASP.NET app. These posts

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.