Reputation: 1
I am making and app for android, and currently on the testing stage. When I use the app, I find that it would be a better experience for the user if he or she would be able to press anywhere on the screen, not just the button? I have text and images on the page, but I want the user to be able to click anywhere. So, I was thinking that the best way to do this would be to make the background a button? currently, I have the background set in Html as follows..
android:background="@drawable/woodbackground"
Any tips would be appreciated. Thanks!
Upvotes: 0
Views: 33
Reputation: 144
You just have to add :
layout.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v){
// Do something
}
});
Upvotes: 1
Reputation: 2062
You can assign an OnClickListener event to the main layout element. Just refer to it with it's id.
Upvotes: 2