Don't mix a ScrollView and ListView. Pick one or the other. On May 8, 11:33 pm, droid-stricken <harik...@gmail.com> wrote: > Hi All, > > I am trying to have a ScrollView in the message part of the > AlertDialog. But, i am unable to get the desired result. Following is > the relevant piece of code. If you find something incorrect in the way > i am building the custom view, please let me know. TIA. > > protected Dialog onCreateDialog(int id) { > switch (id) { > case DIALOG_SEARCH: > dialogLayoutOuter = new ScrollView(this); > LayoutParams scroll_lp = new > LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); > dialogLayoutOuter.setLayoutParams(scroll_lp); > dialogLayoutOuter.setFillViewport(true); > dialogLayoutOuter.setVerticalScrollBarEnabled(true); > > dialogLayout = new LinearLayout(this); > LinearLayout.LayoutParams lp_lv = new > LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, > LayoutParams.WRAP_CONTENT); > dialogLayout.setLayoutParams(lp_lv); > dialogLayout.setOrientation(LinearLayout.VERTICAL); > > int bgColor = 0xFF00FFFF; > int bgColorBlack = 0xFF000000; > LinearLayout.LayoutParams lp_divider = new > LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,2); > LinearLayout.LayoutParams lp_text = new > LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT); > LinearLayout.LayoutParams lp_lv1 = new > LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, > LayoutParams.WRAP_CONTENT); > ListIterator<ListView> itr = myListViewList.listIterator(); > while(itr.hasNext()) { > ListView lv = itr.next(); > TextView myTextView = new TextView(this); > myTextView.setText(lv.getTag().toString()); > myTextView.setBackgroundColor(bgColor); > myTextView.setTextColor(bgColorBlack); > myTextView.setGravity(Gravity.CENTER); > dialogLayout.addView(myTextView, lp_text); > LinearLayout llDivider = new LinearLayout(this); > llDivider.setBackgroundColor(bgColorBlack); > dialogLayout.addView(llDivider, lp_divider); > dialogLayout.addView(lv, lp_lv1); > } > > AlertDialog.Builder dialogBuilder = new > AlertDialog.Builder(this); > > dialogLayoutOuter.addView(dialogLayout); > dialogBuilder.setView(dialogLayoutOuter); > activityDialog = dialogBuilder.create(); > return activityDialog; > } > return null; > > > > }- Hide quoted text - > > - Show quoted text -
-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en