Justin, I changed in xml layout_height of both LinearLayout & ListView as 
"wrap_content" instead of "match_parent. But also same results. This is the 
way I have coded for that layout to create a dialog :

    public AlertDialog createAlertDialog(String title, String[] items, 
> OnItemClickListener clickListener) {
>         
>         LayoutInflater layoutInflater   = 
> (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
>         ViewGroup vg = (ViewGroup) findViewById(R.id.genListLayId);
>         LinearLayout view = (LinearLayout) 
> layoutInflater.inflate(R.layout.gen_list_layout, vg, false);
>         
>         TextView titleTv = (TextView) view.findViewById(R.id.genListTitTv);
>         titleTv.setText(title);
>         
>         ArrayAdapter<String> ad = new ArrayAdapter<String>(this, 
> R.layout.list_item, R.id.listRowView, items);
>         ListView listView = (ListView) view.findViewById(R.id.genList);
>         listView.setAdapter(ad);
>         listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
>         
>         listView.setOnItemClickListener(clickListener);
>         
>         AlertDialog.Builder scrnDlg = new 
> AlertDialog.Builder(MyActivity.this);
>         scrnDlg.setView(view);
>         
>         AlertDialog adg = scrnDlg.create();
>         /*WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
>         lp.copyFrom(adg.getWindow().getAttributes());
>         lp.width = WindowManager.LayoutParams.FILL_PARENT;
>         lp.height = WindowManager.LayoutParams.FILL_PARENT;
>         adg.getWindow().setAttributes(lp);
>         */
>         return adg;
>     }
>

& the way I al calling is :

> alertDlg = createAlertDialog("Title....", names, clickListener);
>                alertDlg.show();
>

  I may need to make some changes over here. I don't know, have added code 
for reference. Hope you can provide some guideline thru this.

Thanks 


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to