开发者

Action Listener on Image View

How to apply action 开发者_运维问答listener on Image view


If you are in your onCreate method, this is quite easy :

//create you ImageView :
ImageView iv = (ImageView) findViewById(R.id.itsId);
//set the listener
iv.setOnClickListener(this);

Then let your activity implement OnClickListener and add unimplemented method. finally, add the behaviour you need in the onClick() method


Type this inside onCreate() :

ImageView image = (ImageView) findViewById(R.id.imageid);

image.setOnClickListener(new OnClickListener() {
    public void onClick(View v)
    {
        //actions
    } 

});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜