开发者

Adding background resource in Java, with if/else or switch.

I need help adding a background on android slider.java, so I want to have a background and to change it like this:

getBackground (开发者_JAVA技巧 R.drawable_slider_bg);
if leftslider = PRESSED (getBackground = (R.drawable.slider_left_bg));
if rightslider = PRESSED (getBackground = (R.drawable.slider_right_bg));

Can someone help please?


// on slider.java

setBackgroundDrawable( R.drawable_slider_bg);

leftSlider.setOnClickListener(new OnClickListener() {
  public void onClick(View v) {
    setBackgroundDrawable(R.drawable.slider_left_bg);
  }
};

rightSlider.setOnClickListener(new OnClickListener() {
  public void onClick(View v) {
    setBackgroundDrawable(R.drawable.slider_right_bg);
  }
};
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜