I want to add an edit text field to my app when i click a button, but i do not change the layout. Just add it below an existing one defined by the xml file. Lets say i have a contacts app and if the user needs to add an extra field hit the button and creates one! How to do that?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
What you can do is have those EditText's in a panel, i.e. group them in panels, then have a button, and on button click create an instance of an EditText and add it to the relevant panel. This way you are not limiting yourself to being only able to add one panel, but as much as the user would like to add.
First of all you call the data from the webservice.
For example: description = Parser.getDescription;
In the xml layout:
Code:
Keep an EditText item in your layout and set its visibility to gone.
Then on the onClick event of the button set visibility to visible.
or
You can add the EditText items programmatically.
Add a LinearLayout to your xml.
On button click event add EditText programmatically.
Hope this would help.