I would like to ask how to set a layout such that when a user presses a button in a row, a popup menu appears next to the button, letting the user choose to edit or delete that row?
also, i would like to ask how can i make a layout such that when the user presses the add button, a popup dialog similar to the AlertDialog pops-up? Inside the pop-up dialog the users can input 4 edittexts?
Can the AlertDialog be amended to accept user input, i.e. EditTexts?
Is there any code for reference?
One easy way to have an edit/delete button is to already have the button in your layout but set its visibility to
View.INVISIBLEinvisible. When the other button is pressed, just change the edit/delete button’s visibility toView.VISIBLE.For the custom dialog, use
AlertDialog.Builderand use thesetView()to use your custom layout inside the dialog.http://developer.android.com/reference/android/app/AlertDialog.Builder.html#setView(android.view.View)
Here’s a blog post with some sample code:
http://android-coding.blogspot.com/2011/05/create-custom-dialog-using.html