Question

We usually code like this innner OnClickListener:

new OnClickListener (){
   void onClick(View v){
              if(v.getId()==R.id.textView1){
                 (TextView) findViewById(R.id.textView1).setText("123456789.......");
                }
    }
 }

If the textView1 view layout_width and layout_height is wrap_content. After the handle click event, the textView1 view and its parent view may be need to be remeasured and redrawn. How to know some view need remeasure and redraw? Is there someone give more detail information for the event chain dispatch?

thanks.

Was it helpful?

Solution

TextView's setText method calls invalidate, which causes the remeasure and redraw.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top