Android application: the TextView becomes invisible after calling addContentView
<p>I am trying to highlight a view with a red rectangle. So I create a HighlightView, and use API addContentView() to show this HighlightView. When I try to highlight a TextView in a ListView, the TextView lost its parent (view.getParent() return null) and became invisible (view.isShown() return false).
Not only the TextView I try to highlight becomes invisible, all the TextView contained in the ListView become invisible!!!</p>

<p>The HighlightView code is as following:</p>

<pre><code>class HighlightView extends View {  
    int outlineColor = Color.RED;
    int outlineWidth = 5;
    int height = 0;
    int width = 0;

    public HighlightView(Context context, int height, int width) {  
        super(context);
        this.height = height;
        this.width = width;
    }  

    @Override  
    protected void onDraw(Canvas canvas) {  
        super.onDraw(canvas);
        Paint paint = new Paint();

        paint.setStrokeWidth(outlineWidth);
        paint.setColor(outlineColor);
        //Draw an rectangle outline around the view
        canvas.drawLine(0, 0, 0, height, paint);
        canvas.drawLine(0, height, width, height, paint);
        canvas.drawLine(width, height, width, 0, paint);
        canvas.drawLine(width, 0, 0, 0, paint);
    }  
} 
</code></pre>

<p>I will highlight a view like this:</p>

<pre><code>//view it the View to be highlighted
Rect rect = new Rect();
view.getDrawingRect(rect);
HighlightView highView = new HighlightView(this, rect.height(), rect.width());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
this.addContentView(highView, params);
</code></pre>

<p>The TextView I try to highlight is in the ListView of android APIDemos application.</p>

<p>Does anybody know the reason? Is it possible to set the TextView visible. (I tried to call <code>view.setVisibility(View.VISIBLE);</code>, but it doesn't work, because its parent is set to null)</p>
