How to handle stickers with resize and rotate functionality? [closed]

こ雲淡風輕ζ 提交于 2019-12-04 07:35:38

问题


I am currently developing an application which will allow user to add stickers (hat, hairs, spectacles etc) on image. User can resize that sticker or can rotate that and move also. See image.

I have stickers, but how can I put them on original image and move/rotate/enlarge them to adjust on original image?


回答1:


You can check the below link for stickerView

  1. https://github.com/nimengbo/StickerView
  2. https://github.com/kencheung4/android-StickerView
  3. https://github.com/uptechteam/MotionViews-Android
  4. https://github.com/wuapnjie/StickerView
  5. https://github.com/sangmingming/StickerView
  6. https://github.com/niravkalola/Android-StickerView
  7. https://github.com/Kaka252/StickerView
  8. https://github.com/yovenny/StickerView



回答2:


I found a good result at http://code.google.com/p/android-multitouch-controller/. Which handles 3 in 1 facility. On Multi-Touch, you can pan your image, you can scale your image and at the same time you can also rotate your image. And you can add number of stickers as you want.




回答3:


To enlarge/reduce an image, you can try the following code:

yourImageView.setLayoutParams(new GridView.LayoutParams(newWidthImage, newHeightImage));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

Hope this help.




回答4:


First step : Download this link Lib. https://github.com/nimengbo/StickerView

Second : (StickerView,BubblePropertyModel,StickerPropertryModel.java in this three file paste your project).

Third step : Below Code Past your MainActivity File:

Note: mainlayout is (Relativelayout object)

 final StickerView stickerView21 = new StickerView(this);
            stickerView21.setImageResource(R.drawable.fall_9);

            stickerView21.setOperationListener(new  StickerView.OperationListener() {
                @Override
                public void onDeleteClick() {
                    mViews.remove(stickerView21);
                    mainLayout.removeView(stickerView21);
                }

                @Override
                public void onEdit(StickerView stickerView)
                {

                }

                @Override
                public void onTop(StickerView stickerView) {
                    int position = mViews.indexOf(stickerView);
                    if (position == mViews.size() - 1) {
                        return;
                    }
                    StickerView stickerTemp = (StickerView) mViews.remove(position);

                    mViews.add(mViews.size(), stickerTemp);
                }
            });


            RelativeLayout.LayoutParams l11= new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
            mainLayout.addView(stickerView21, l11);
            mViews.add(stickerView21);



回答5:


Check out the blogspot they tried to implement the functionality of stretch the image on arrow click and also delete it, and also you can move the image on the screen using gesture.

Drag-Drop image Also check out the Demo of DragDropImage

You can also download the source code which is mentioned in blog.

https://stackoverflow.com/a/22908379/3034199



来源:https://stackoverflow.com/questions/15475805/how-to-handle-stickers-with-resize-and-rotate-functionality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!