View v1 = new View(this);
v1.setClickable(true);
v1.setFocusable(true);
OR
From xml
This will prevent touch and click events from being propagated to views that stay below your view.
Or if you inflate the View then to .xml add android:clickable="true"