I'm developing an android widget and i would like to start a certain activity when i tap on a certain area of my widge开发者_运维技巧t, and another one when tapping somewhere else. How can i do this ?
Thank you!
Create 2 Linear Layouts in places wherever you want to touch, and let them be blank (No child).
Then add android:clickable = "true"
in linear layouts. and now add clicklisteners to thes two layouts and start Activity..
Something like this..
LinearLayout layout = (LinearLayout)findViewById(R.id.layoutId);
layout.setOnClickListener(new OnClickListener(){
protected void onClick(View v){
//start Activity
}
});
精彩评论