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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:43:38+00:00 2026-06-14T18:43:38+00:00

I have a frame layout that consists of a edittext and button (to remove

  • 0

I have a frame layout that consists of a edittext and button (to remove the field) that i want to add multiple times to a relative layout when a user clicks a button.

I have searched but i just cant find how to do this programmatically.

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" >

    <EditText
        android:id="@+id/inputbox"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:textSize="25sp"
        android:textStyle="bold"
        android:hint="@string/inputhint"
        android:ems="10"
        android:imeOptions="actionNext"
        android:singleLine="true" />

    <Button
        android:id="@+id/buttonremove"      
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginRight="10dp"
        android:layout_gravity="right|center_vertical"
        android:background="@drawable/remove" />

</FrameLayout>
  • 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-14T18:43:39+00:00Added an answer on June 14, 2026 at 6:43 pm

    It is much easier to do, when the container is a LinearLayout with vertical orientation, not a RelativeLayout.

    ViewGroup container = (ViewGroup) findViewById(R.id.container);
    getLayoutInflater().inflate(R.layout.input, container, true);
    

    Just retrieve the LinearLayout (container) and then inflate the layout with the container as parent. With attachToRoot set to true, it will automatically be added to the container.

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

Sidebar

Related Questions

I have custom gallery. Gallery represents items that are frame layout. There are one
Ho I have two list view on a frame layout. I want one overlay
I have wrote a method to convert any layout Liner,Relative,Frame etc into Bitmap but
I have a CSS layout that simulates a fixed-frame page, with a header and
I have a frame layout encompassing an imageview that's supposed to update the image
Right I have a main layout defined, that has a frame, a table in
I have a xml-layout that consists two FrameLayouts(f1 and f2). F1 fills all screen's
I have main tabHost layout that its frame content is set on another layout
I want to achieve a simple frame layout with fixed header, fixed left navigation
Suppose I have a data frame, df, that looks like: f t1 t2 t3

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.