title: How to align TextView around an ImageView?
body: <p><img src="https://i.stack.imgur.com/cR11Y.png" alt="enter image description here"></p>
  
  <p>I am trying to align the TextView around ImageView. I am using the following code: </p>
  
  <pre><code> private void createSpannableText(){
          TextView myTextView = (TextView) findViewById(R.id.textView);
          SpannableStringBuilder builder = new SpannableStringBuilder();
          builder.append(this.getText(R.string.loren__ipsum__max));
          int lengthOfPart1 = builder.length();
          builder.append(" ");
          builder.append(this.getText(R.string.lorem__ipsum));
          Drawable d = getResources().getDrawable(R.drawable.myImage);
          d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); // &lt;---- Very important otherwise your image won't appear
          ImageSpan myImage = new ImageSpan(d);
          builder.setSpan(myImage, 0, lengthOfPart1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
          myTextView.setText(builder);
      }
  </code></pre>
  
  <p>But couldn't get the exact result. What shall I do? Do I need to use SpannableStringBuilder in this case or there is another way. Please help. I used this post-<a href="http://majaxandroidtips.blogspot.in/2009/06/how-to-have-few-layout-elements-wrap_17.html" rel="noreferrer">http://majaxandroidtips.blogspot.in/2009/06/how-to-have-few-layout-elements-wrap_17.html</a>
  to have the solution.</p>
  
  <p>P.S.: I also want 6dp margin around the ImageView </p>