Code example for LinearLayout

Methods: addViewsetOrientation, setTag

0
                      ViewGroup parent) {
    ViewWrapper wrap=null;
    View row=convertView;
                             
    if (convertView==null) {
      LinearLayout layout=new LinearLayout(ctxt);
      RatingBar rate=new RatingBar(ctxt);
       
      rate.setNumStars(3);
      rate.setStepSize(1.0f);
       
      View guts=delegate.getView(position, null, parent);
     
      layout.setOrientation(LinearLayout.HORIZONTAL); 
           
      rate.setLayoutParams(new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.FILL_PARENT));
      guts.setLayoutParams(new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.FILL_PARENT,
            LinearLayout.LayoutParams.FILL_PARENT));
       
      RatingBar.OnRatingBarChangeListener l=
                    new RatingBar.OnRatingBarChangeListener() {
        public void onRatingChanged(RatingBar ratingBar,
                                      float rating,
                                      boolean fromTouch)  {
          rates[(Integer)ratingBar.getTag()]=rating;
        } 
      }; 
       
      rate.setOnRatingBarChangeListener(l);
           
      layout.addView(rate);          
      layout.addView(guts);
       
      wrap=new ViewWrapper(layout);
      wrap.setGuts(guts);
      layout.setTag(wrap);
       
      rate.setTag(new Integer(position));
      rate.setRating(rates[position]);
         
      row=layout;