I have a TextView
that converts to an EditView
on touch. However, I want the opposite to occur when a user touches anywhere outside of the EditView
. I've tried to use setOnFocusChangeListener
, but that only appears to work when something else gains focus. I know I can intercept onTouch
and check there, but is there a simpler way to handle this scenario?
Set parent of TextView
and edit view to focusable.
Make all layouts and views clickable, and implement onClickListener on each, write onClickListener like below:
private ClickListener implements OnClickListener
{
public void onClick(View view)
{
if(v.getId()!=R.id.editView)
{
//Write your code here to replace views
}
}
}