I have a custom view that extends LinearLayout. The view looks like progress bar with a little icon that moves on every click. the updating method is :
public void setPointerOffset(int mPointerOffset) {
this.mPointerOffset = mPointerOffset;
updateSlider();
invalidate();
requestLayout();
}
private void updateSlider() {
PercentFrameLayout.LayoutParams params = (PercentFrameLayout.LayoutParams) mPointer.getLayoutParams();
PercentLayoutHelper.PercentLayoutInfo info = params.getPercentLayoutInfo();
if (mPointerOffset < MIN_OFFSET)
mPointerOffset = MIN_OFFSET;
if (mPointerOffset > MAX_OFFSET)
mPointerOffset = MAX_OFFSET;
float percent = mPointerOffset * 0.01f;
info.startMarginPercent = percent;
}
This method is fired up from onClickListener. This is working great in low api like 17, but on the lest on (25) it doesn't working at all.