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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:45:32+00:00 2026-06-06T10:45:32+00:00

How to create a dynamic button view like this ? Here +Add button is

  • 0

How to create a dynamic button view like this ?
Here +Add button is a static one. Other buttons should be dynamically created as in this picture. According to the retrieved data from a database this have t be created and with the add button it could add new buttons.

Dynamic Button View

  • 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-06T10:45:33+00:00Added an answer on June 6, 2026 at 10:45 am

    In your xml file have a linear layout of orientation Vertical.

    In the java class file declare it as

    ViewGroup lr = (ViewGroup)findViewVyId(R.id.dd)

    for(int i = 0; i < x1; i++)
    {
         lr1 = new LinearLayout(this);
         lr1.setOrientation(LinearLayout.HOIZONTAL);
         lr.addView(lr1);
         for(int j = 0; j < xx1; j++ )
         {
             if(i==0)
             {
            if(j == 0)
            {
              final View child = getLayoutInflater().inflate(R.layout.nw, null);
              lr.addView(child);
            }
            else
            {
                lr2 = new LinearLayout(this);
                lr2.setOrientation(LinearLayout.VERTICAL);
    
                for(int k = 0; k<2; k++)
                {
                    final View b3 = new Button(this);
                    lr2.addView(b3);
                }
                lr.addView(lr2);
            }
          }
          else
          {
            final View b2 = new Button(this);
            lr.addView(b2);
          }
          lr1.setId(main_cnt);
          main_cnt++;
              if(i == 2)
              {
            if(j == 2)
            {
                break;
            }
              }
         }
    }
    

    the first for loop decides how many layouts to be in vertical order and the second for loop decides how many button inside the linear layout in Horizontal order. The main_cnt is used to get an id for each button

    The xml file of child is where i have place the Add(large button)

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

Sidebar

Related Questions

Is there any way to create a dynamic Pinterest button? I'm trying to add
I create some dynamic textbox's and a button in a placeholder and would like
I have created one dynamic button in my application and I call the following
I would like to create some buttons with dynamic width using CSS sprites and
I want to be able to create links looking like buttons with dynamic text
i have some problem.. i have created a dynamic button in a table view.
Basically, I want to create a button underneath a grouped table view, like contacts.app
Here is what I did, this is a dynamic questionary application; -Created a UINavigationBased
I ve created the 8 buttons dynamically.I want to add all these buttons to
I want to create dynamic buttons on button click event(for example., btnCreateDynamic_Click). I tried

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.