StickerView
StickerView copied to clipboard
how to set an Sticker in specific position in view
Hello , i want to save the last position of Sticker , and when i reload an app i want to set the Sticker on last position do you have an idea ?
@HoussemHfaidh i use for this Matrix
If it helps, I wait until after the sticker is added, in a StickerView.OnStickerOperationListener
, and then adjust its matrix:
@Override public void onStickerAdded(@NonNull Sticker sticker) {
// you provide desired_w, desired_h, desired_left, desired_top
sticker.setMatrix(freshInsetMatrix(desired_w, desired_h, desired_left, desired_top));
}
private Matrix freshInsetMatrix() {
float sticker_w = inset_sticker.getWidth();
float sticker_h = inset_sticker.getHeight();
float scale_x = desired_w / sticker_w;
float scale_y = desired_h / sticker_h;
Matrix matrix = new Matrix();
matrix.postTranslate(desired_x / scale_x, desired_y / scale_y);
matrix.postScale(scale_x, scale_y);
return matrix;
}
Hi, thank you for your support :)
2017-09-20 10:44 GMT+01:00 instantiator [email protected]:
If it helps, I wait until after the sticker is added, in a StickerView. OnStickerOperationListener, and then adjust its matrix:
@Override public void onStickerAdded(@NonNull Sticker sticker) { // you provide desired_w, desired_h, desired_left, desired_top sticker.setMatrix(freshInsetMatrix(desired_w, desired_h, desired_left, desired_top)); }
private Matrix freshInsetMatrix() { float sticker_w = inset_sticker.getWidth(); float sticker_h = inset_sticker.getHeight();
float scale_x = desired_w / sticker_w; float scale_y = desired_h / sticker_h; Matrix matrix = new Matrix(); matrix.postTranslate(desired_x / scale_x, desired_y / scale_y); matrix.postScale(scale_x, scale_y); return matrix;
}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wuapnjie/StickerView/issues/58#issuecomment-330801676, or mute the thread https://github.com/notifications/unsubscribe-auth/ASXm7KmGgT74c_brvXYCawG-CGwH_dgrks5skN54gaJpZM4O2U9l .
--
*Cordialement * Houssem Hfaidh Web & Mobile Developper Tel : 00216 20 26 94 16
@instantiator how can i place sticker below another sticker?
@instantiator it works for me but for diff devise position is little changed how can i fixed it for all devise