Shibakaneki
Shibakaneki

Reputation: 212

android: visual issues on a custom slider

I created a custom slider that was working fine, but suddenly it started showing visual issues and i have no idea where to look to solve this problem.

the issue is the appearance of black borders/gradients around it. i tested on android 6 and android 4.0.3 as well. both are showing the same problem. on android 4.0.3, i can also see this problem around the actions in the toolbar when i press on them, it makes like a black gradient shadow.

enter image description here

any idea?

the code of my slider is:

public class StyledSeekBar extends SeekBar {
public StyledSeekBar(Context context) {
    super(context);
    this.init();
}

public StyledSeekBar(Context context, AttributeSet attrs) {
    super(context, attrs);
    this.init();
}

public StyledSeekBar(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.init();
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public StyledSeekBar(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    this.init();
}

/**
 * Initializes the instance of this class.
 */
private void init(){
    setThumb(getResources().getDrawable(R.drawable.apptheme_scrubber_control_selector_holo_light));
    setIndeterminateDrawable(getResources().getDrawable(R.drawable.apptheme_scrubber_progress_horizontal_holo_light));
    setProgressDrawable(getResources().getDrawable(R.drawable.apptheme_scrubber_progress_horizontal_holo_light));
}
}

Upvotes: 2

Views: 71

Answers (2)

Shibakaneki
Shibakaneki

Reputation: 212

I found the solution! To fix this kind of issue, it is necessary to verify the 9-patch images and resolve all the bad patches. This can be done by using the draw9patch tool.

Upvotes: 0

sergii.gudym
sergii.gudym

Reputation: 173

it's no shadow. Looks like .png stretched. Try 9png

Upvotes: 1

Related Questions