how to add a text before a shape in a view dynamically?
<p>As my requirement is to display a horizontal graph. I have created that graph. But I need to add text before and after the bars, to indicate which bar is what in the graph. I did not get any idea after a brief research. Can any one give some suggestion to do that. Any response will be appreciated.</p>

<p>Here is my code to draw shapes in my view class.</p>

<pre><code>public class RectangleView extends View{

private ShapeDrawable[] mDrawables1,mDrawables2;

public RectangleView(Context context) {

super(context);

setFocusable(true);

setBackgroundColor(0xFFFFFFFF);

mDrawables1 = new ShapeDrawable[1];

mDrawables2 = new ShapeDrawable[1];

mDrawables1[0] = new ShapeDrawable(new RectShape());

mDrawables2[0] = new ShapeDrawable(new RectShape());

mDrawables1[0].getPaint().setColor(0xFF347235);

mDrawables2[0].getPaint().setColor(0xFF348017);

}



@Override protected void onDraw(Canvas canvas) {

Log.d("0000000","9999999");


for (Drawable dr : mDrawables1) {

int x1 = 10;

int y1 = 45;

int width1 = 200;

int height1 = 20;

dr.setBounds(x1, y1, x1 + width1, y1 + height1);

dr.draw(canvas);

y1 += height1 + 5;

}

for (Drawable dr : mDrawables2) {

int x1 = 10;

int y1 = 20;

int width1 = 200;

int height1 = 20;

dr.setBounds(x1, y1, x1 + width1, y1 + height1);

dr.draw(canvas);

y1 += height1 + 5;
}

}
}
</code></pre>

<p>and now I have added this view in my activity using the addView() method. I want to place some text left to the bar and some value to the right of the bars.
If any one experienced in this, please help me to add the text here. I would look forward to here your response quickly.</p>

<p>Thanks in advance</p>
