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);
}
};
精彩评论