I am trying to create an activity that allows me to dynamically add an previously undetermined number of views to a layout in a vertical manner. I need this layout to scroll in the case where the views take up more space than the screen. I also need to be able to add buttons to the layout on an absolute level. The following is the skeleton my my code, but the onDraw for my views is never actually called. Anyone have any suggestions.
Thanks ahead of time. public class RepMed2 extends Activity{ ScrollView reportView; ArrayList<Button> buttons; AbsoluteLayout myLayout; LinearLayout mLL; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //initiating views reportView = getView(); myLayout = new AbsoluteLayout(this); myLayout.setLayoutParams(new AbsoluteLayout.LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, 0 , 0)); myLayout.addView(reportView); setContentView(myLayout); reportView.invalidate(); myLayout.bringToFront(); } private ScrollView getView(){ //setup new linearlayout mLL = new LinearLayout(this); mLL.setOrientation(LinearLayout.VERTICAL); mLL.setLayoutParams(new LinearLayout.LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); mLL.setVerticalScrollBarEnabled(true); mLL.setBackgroundColor(0xffffcc99); addViews(); ScrollView sv = new ScrollView(this); sv.setLayoutParams(new LinearLayout.LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); sv.addView(mLL, new LinearLayout.LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); return sv; } private void addViews() { int medicationLength = medicationNodes.getLength(); for (int i=0; i < medicationLength; i++) { ReportView2 rep = new ReportView2(this, med, timeOfInterval); mLL.addView(rep); } } } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---