background代码怎么用,background怎么设置

http://www.itjxue.com  2023-01-23 11:11  来源:未知  点击次数: 

java的setBackground怎么用?

java中setBackground的作用是设置背景颜色或者图片。在android中是给某一个控件设置背景,如下:

private?void?addNewButton(Integer?id,?String?name)?{

????????Button?b?=?new?Button(this);

????????b.setId(id);

????????b.setText(name);

????????b.setTextColor(color.white);

????????b.setBackground(this.getResources().getDrawable(R.drawable.orange_dot));//设置按钮的背景图片

????????????//llPageIndicator?is?the?Linear?Layout.

????????llPageIndicator.addView(b);

}

HTML中的background

默认的是平铺用no-repeat(不平铺) repeat-x(只横向平铺) repeat-y(只纵向平铺) 如果在横向纵向后面在加个上下左右的代码,就可以在你想要的地方平铺例:background:url(图片路径) no-repeat bottom(top"默认的,可以不输入"right"右")图片只显示在左下角(左上角,右上角)

background:url() repeat-x bottom(top"默认的")底部横向平铺

background:url() repeat-y right(left"默认的") 右边纵向平铺

Dw代码中插入背景图片的代码是什么?

Dw代码中插入背景图片的代码的具体步骤如下:

我们需要准备的材料分别是:电脑、DW。

1、首先我们打开需要编辑的DW文件,点击需要插入背景图片的地方。

2、然后我们点击打开主菜单栏中的“插入”中的“Image”,之后点击选择想要插入的图片。

3、然后我们在弹出来的窗口中就可以看到图片的代码了。

(责任编辑:IT教学网)

更多

推荐网页背景文章