I am making an alarm clock. I want to make an activity which on the layout part is empty (exept a photo on the background) I want to do, that if i touch anywhere on the screen, the music will stop.
I thought about making the img as a imageview... but it dosent strach on the screen when I do it (even if the parameters are on the whole screen)
help?
in your layout verify that :
android:clickable="true"
android:focusable="true"
android:focusableInTouchMode="true"
then try to use onTouchListener
then try :
yourActivityLayout.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
// action to do
return true;//always return true to consume event
}
});