title: Issues setting View parameters in View Holder pattern
body: <p>I'm using an ArrayAdpater with ListView. I have customized each item with my own layout, which include from top-level view hierarchy, a <code>RelativeLayout</code> -> <code>LinearLayout</code> -> other inner views.</p>
  
  <p>I'm recycling the view, and I'm using the View Holder pattern. My <code>getView()</code> inside the adapter is:</p>
  
  <pre><code>    @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View rowView = convertView;
          ViewHolder holder;
  
          if(rowView == null){
              LayoutInflater inflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);            
              rowView = inflater.inflate(R.layout.custom_row, parent, false);
  
              holder = new ViewHolder();
              holder.tvMessage = (TextView)rowView.findViewById(R.id.chat_text_message);
              holder.tvUser = (TextView)rowView.findViewById(R.id.user);
              holder.llMessageBubble = (LinearLayout)rowView.findViewById(R.id.message_bubble);
  
              rowView.setTag(holder);
          }else {
  
              holder = (ViewHolder) rowView.getTag();
          }
              setRow(holder, messageList.get(position).getUser(),messageList.get(position).getTextMessage());
  
          return rowView;
      }
  </code></pre>
  
  <p>Where </p>
  
  <pre><code>public static class ViewHolder{
       TextView tvMessage;
       TextView tvUser;
       LinearLayout llMessageBubble;
  }
  </code></pre>
  
  <p>and setRow method is defined as:</p>
  
  <pre><code>    private void setRow(ViewHolder holder, String user, String message){
          if(user.equals("Me")){
  
              RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)holder.llMessageBubble.getLayoutParams();
              params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
  
              holder.llMessageBubble.setLayoutParams(params);
          }else{
  
              RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)holder.llMessageBubble.getLayoutParams();
              params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
  
              holder.llMessageBubble.setLayoutParams(params);
          }
          holder.tvMessage.setText(message);
          holder.tvUser.setText(user);
      }
  </code></pre>
  
  <p>When the ListView is shown for the first time, all works good, so I can see my LinearLayout (inside RelativeLayout) aligned to the left or to the right based on the string user.
  But something goes wrong when I scroll up and down for a while: after a certain period, all the <code>LinearLayout</code>s are aligned to the RIGHT in the Parent. Seems that something is wrong in the recycling.</p>