android之setBackgroundDrawable()

转于:http://houwanji.blog.163.com/blog/static/16227622009724113953183/

--------------------------------------------------------------------------------------------------------

setBackgroundDrawable()的用法
 设置控件的背景图片:如下所示

        ImageButton btn = (ImageButton)findViewById(R.id.button2);
        Drawable dr = this.getResources().getDrawable(R.drawable.icon); //取得图片资源

        btn.setBackgroundDrawable(dr);  //设置btn的背景图片

猜你喜欢

转载自yuemeiqing2008-163-com.iteye.com/blog/2092444