2011-12-01 44 views

回答

14

你去那裏

TextView tv = (TextView)findViewById(R.id.textview); 
tv.setOnClickListener(new OnClickListener() { 

    @Override 
    public void onClick(View v) { 
     // do whatever stuff you wanna do here 
    } 
}); 
1
public void setClickable (boolean clickable) 

Enables or disables click events for this view. When a view is clickable 
it will change its state to "pressed" on every click. Subclasses should 
set the view clickable to visually react to user's clicks. 
Related XML Attributes 

TextView tv = new TextView(this); 
tv.setClickable(true); 
tv.setOnClickListener(new OnClickListener(){ 
    public void onClick(View v) { 
    } 
}); 
0

您可以點擊設置這樣

tv.setOnClickListener(new View.OnClickListener() { 

     @Override 
     public void onClick(View v) { 
      // TODO Auto-generated method stub 

     } 
    }) 
監聽器