Zelig
Zelig

Reputation: 157

Entering a text in a dialog form

What I want to do is quite simple : to display a dialog form containing an EditText in which the user can specify a message.

So far, I have tried to use the DialogFragmentclass. With the explanations found in the developer's guide, I have been able to display an alert dialog box showing a message. But I can't figure out how neither to change the layout of the AlertDialog created to use an XML file of my own or to replace the AlertDialog with a customized class extending the View class for instance.

Am I missing something? Or am I completely on the wrong way?

Thanks in advance for the time you will spend trying to help me.

Upvotes: 1

Views: 90

Answers (1)

Quintin Robinson
Quintin Robinson

Reputation: 82325

You absolutely can do this, even using an AlertDialog!

You just have to set a custom layout for the dialog, in AlertDialog you would use the setView method and if you want to use a more generic dialog you can use the setContentView method.

You can take a look at http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog for some more information and an example.

The example in the link provided is contrived without question but it is meant as a stepping stone towards a goal similar to what you are trying to accomplish.

There is a similar question/answer that might be of use to you.

Upvotes: 1

Related Questions