alignment of contents in ListView
===

I have a listview and I want some contents to be shown on the left and other contents on the right of the list :
[for example][1]

Meaning that the content which getItem(position).getIsMO() == false
to be shown in the left side of the list
and the content which getItem(position).getIsMO() == true
to be shown in the right side of the list.

The code of that part is:

     	public static class EfficientAdapter extends ArrayAdapter<Message>
    			implements Filterable {
    		private LayoutInflater mInflater;
    		// private Bitmap mIcon1;
    		private final Context context;
    		private final ArrayList<Message> values;
    
    		public EfficientAdapter(Context context, ArrayList<Message> values) {
    			// Cache the LayoutInflate to avoid asking for a new one each time.
    			super(context, R.layout.mycontent, values);
    			mInflater = LayoutInflater.from(context);
    			this.context = context;
    			this.values = values;
    		}
    
    		/**
    		 * Make a view to hold each row.
    		 * 
    		 * @see android.widget.ListAdapter#getView1(int, android.view.View,
    		 *      android.view.ViewGroup)
    		 */
    		@Override
    		public View getView(final int position, View convertView,
    				ViewGroup parent) {
    			// A ViewHolder keeps references to children views to avoid
    			// unneccessary calls
    			// to findViewById() on each row.
    			ViewHolder holder;
    			// When convertView is not null, we can reuse it directly, there is
    			// no need
    			// to reinflate it. We only inflate a new View when the convertView
    			// supplied
    			// by ListView is null.
    
    			if (convertView == null) {
    				convertView = mInflater.inflate(R.layout.mycontent, null);
    
    				holder = new ViewHolder();
    				if (getItem(position).getIsMO() == false) {
    					// parent.setPadding(0, 0, 15, 0);
    					// convertView.layout(15, 0, 0, 0);
    					holder.body = (TextView) convertView
    							.findViewById(R.id.body);
    					holder.date = (TextView) convertView
    							.findViewById(R.id.date);
    					holder.from = (TextView) convertView
    							.findViewById(R.id.from);
    					holder.status = (TextView) convertView
    							.findViewById(R.id.status);
    				} else {
    					// convertView.layout(0, 0, 15, 0);
    					// parent.setPadding(15, 0, 0, 0);
    
    					holder.body = (TextView) convertView
    							.findViewById(R.id.body);
    					holder.date = (TextView) convertView
    							.findViewById(R.id.date);
    					holder.from = (TextView) convertView
    							.findViewById(R.id.from);
    					holder.status = (TextView) convertView
    							.findViewById(R.id.status);
    				}
    				convertView.setTag(holder);
    			}
    
    			else {
    				// Get the ViewHolder back to get fast access to the TextView
    				// and the ImageView.
    				holder = (ViewHolder) convertView.getTag();
    			}
    			convertView.setOnClickListener(new OnClickListener() {
    				private int pos = position;
    
    				@Override
    				public void onClick(View v) {
    					Toast.makeText(context, "Click-" + pos, Toast.LENGTH_SHORT)
    							.show();
    				}
    			});
    
    			holder.body.setText(getItem(position).getBody());
    			holder.date.setText(getItem(position).getDate());
    			holder.from.setText(getItem(position).getPhoneNumber());
    			holder.status
    					.setText(String.valueOf(getItem(position).getStatus()));
    			/*
    			 * if ("000".equals(getItem(position).getPhoneNumber())) { //
    			 * convertView.setPadding(5, 0, 0, 0); // View layout =
    			 * View.inflate(context, R.layout.mycontent, null); //
    			 * layout.setPadding(5, 0, 0, 0);
    			 * convertView.setLayoutParams(params); // parent.setPadding(5, 0,
    			 * 0, 0); } else { // View layout = View.inflate(context,
    			 * R.layout.mycontent, null); // layout.setPadding(0, 0, 5, 0);
    			 * parent.setPadding(0, 0, 5, 0); // convertView.setPadding(0, 0, 5,
    			 * 0); }
    			 */
    			return convertView;
    
    		}
    
    		static class ViewHolder {
    			TextView from;
    			TextView date;
    			TextView body;
    			TextView status;
    		}
    }

The problem is that when I try the parent.setPadding() all the objects align in the listview in one side.

Thank you for your time
mkounal


  [1]: http://lh3.ggpht.com/l9BfwHuON835jCoyVvFVBSRXTs-kv1Aca3Rb1q4RPeUAvBoNUnd5ZG7mT5scJhmK35rh
