title: Button position in android
body: <p>I'm trying to make some &quot;Chat view&quot; with speech bubbles like on the SMS iPhone app.
  This is a row I have done in the xml editor :</p>
  <p><a href="http://img44.imageshack.us/i/xml.png/" rel="nofollow noreferrer">http://img44.imageshack.us/i/xml.png/</a></p>
  <p>But when I launch my application, I get this :</p>
  <p><a href="http://img59.imageshack.us/i/resultt.png/" rel="nofollow noreferrer">http://img59.imageshack.us/i/resultt.png/</a></p>
  <p>I don't know why the button to answer is so far away from my Relative layout border! This is the xml code of the speech bubble:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;RelativeLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:background=&quot;@drawable/bulle_chat&quot;
      android:layout_width=&quot;fill_parent&quot;&gt;
      &lt;ImageView android:layout_alignParentLeft=&quot;true&quot;
          android:layout_alignParentTop=&quot;true&quot;
          android:layout_height=&quot;40sp&quot;
          android:layout_width=&quot;40sp&quot;
          android:id=&quot;@+id/ImageViewPhoto&quot;
          android:scaleType=&quot;fitXY&quot;
          android:layout_margin=&quot;8sp&quot;
          android:src=&quot;@drawable/lady&quot;&gt;
      &lt;/ImageView&gt;
      &lt;TextView android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_toRightOf=&quot;@+id/ImageViewPhoto&quot;
          android:layout_alignTop=&quot;@+id/ImageViewPhoto&quot;
          android:id=&quot;@+id/TextViewPseudo&quot;
          android:text=&quot;Pseudo&quot;
          android:textColor=&quot;#242424&quot;
          android:textStyle=&quot;bold&quot;&gt;
      &lt;/TextView&gt;
      &lt;TextView android:layout_below=&quot;@id/TextViewPseudo&quot;
          android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:id=&quot;@+id/TextViewDate&quot;
          android:text=&quot;Date&quot;
          android:layout_toRightOf=&quot;@+id/ImageViewPhoto&quot;&gt;
      &lt;/TextView&gt;
      &lt;Button android:layout_alignParentRight=&quot;true&quot;
          android:layout_alignParentTop=&quot;true&quot;
          android:id=&quot;@+id/ButtonAnswer&quot;
          android:layout_height=&quot;40sp&quot;
          android:layout_width=&quot;40sp&quot;
          android:layout_margin=&quot;8sp&quot;&gt;
      &lt;/Button&gt;
      &lt;TextView android:layout_width=&quot;wrap_content&quot;
          android:layout_height=&quot;wrap_content&quot;
          android:layout_below=&quot;@+id/ImageViewPhoto&quot;
          android:layout_alignLeft=&quot;@+id/ImageViewPhoto&quot;
          android:textColor=&quot;#000000&quot;
          android:text=&quot;BlbalblablbalbalbalbalbalablabalbalablaballabalbBlbalblablbalbalbalbalbalablabalbalablaballabalbalbalaBlbalblablbalbalbalbalbalablabalbalablaballabalbalbalablablaalbalabla&quot;
          android:id=&quot;@+id/TextViewMessage&quot;
          android:layout_alignRight=&quot;@+id/ButtonAnswer&quot;
          android:paddingBottom=&quot;15sp&quot;&gt;
      &lt;/TextView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  <p>And this is the adapter getView() method (pseudo = nickname):</p>
  <pre><code>public View getView(int position, View convertView, ViewGroup parent) {
      LayoutInflater inflater = ctx.getLayoutInflater();
      View v = inflater.inflate(R.layout.chat_row, null);
      TextView pseudo = (TextView)v.findViewById(R.id.TextViewPseudo);
      TextView date = (TextView)v.findViewById(R.id.TextViewDate);
      TextView message = (TextView)v.findViewById(R.id.TextViewMessage);
      ImageView icon = (ImageView)v.findViewById(R.id.ImageViewPhoto);
      Button b = (Button)v.findViewById(R.id.ButtonAnswer);
      b.setId(position);
      b.setOnClickListener((OnClickListener) ctx);
          
      pseudo.setText(listMessages.get(position).getPseudo());
      pseudo.setTextColor(0xFF000000);
      date.setText(listMessages.get(position).getDate());
      date.setTextColor(0xFF000000);
          message.setText(listMessages.get(position).getText());
      message.setTextColor(0xFF000000);
      message.setGravity(Gravity.CLIP_HORIZONTAL);
          
      if (listMessages.get(position).getThumb()!=null){
          icon.setImageBitmap(listMessages.get(position).getThumb());
      } else {
          icon.setImageResource(R.drawable.unknown);
      }
      return v;
  }
  </code></pre>
  <p>As you can see, I set the layout alignment parent right and top to true but it doesn't work. Another problem: if I want to change the background of my button, this one disappears!</p>
  <p>Thanks for your help!!</p>