开发者

How to create custom dialog box with custom listview

Thanks for previous questions.

Is it possible to create a custom dialog box which includes custom listview which contains radio button. to be simple i want to create a dialog box which includes list view and radio button. i tried default listview inside the dialog box but the 开发者_StackOverflow中文版radio button is not indicating the item. How to give a default listview radio button that should always indicate the item. pls help me


Yes it is possible to create custom dialog box with custom layout. For that,

  Dialog dialog = new Dialog(**Your Context**);
  dialog.setContentView(R.layout.**Your Layout File**);
  dialog.show();

In this layout file you can make your layout as per your requirements. When you want to use ListView from your Dialog Layout file then you have to write

  ListView listView = (ListView)**dialog**.findViewById(R.id.**Your ListView Id**);

If you can not understand then I'll give you Example.

I hope it helps you.. :)

Thanks.


Android provides a facility to create the custom dialog with custom layout. See the bellow links.It may help you. http://www.helloandroid.com/tutorials/how-display-custom-dialog-your-android-application

http://www.androidpeople.com/android-custom-dialog-example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜