简体   繁体   English

如何在Android Image Crop Screen中添加旋转按钮?

[英]How to add rotate button to Android Image Crop Screen?

I am using the below intent to crop the images selected from gallery or taken by camera: 我正在使用以下意图裁剪从图库中选择或由相机拍摄的图像:

Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");

However I need to add rotate buttons to that screen as well. 但是,我还需要向该屏幕添加旋转按钮。 Is there a way to do that? 有没有办法做到这一点?

Thanks in advance. 提前致谢。

You can't do this. 你做不到 Because the Activity that you are talking about is not your Activity. 因为您正在谈论的活动不是您的活动。

If you really need this, you will have to implement your own cropping functionality. 如果确实需要此功能,则必须实现自己的裁剪功能。 Find the class corresponding to the AOSP cropping class and reuse it as you need it. 查找与AOSP裁剪类相对应的类,然后根据需要重新使用它。

Try this: Set an onCLickListener on a normal button and perform your rotate function inside it. 尝试以下操作:在普通按钮上设置onCLickListener在其中执行您的rotate function I don't really know how to rotate but the following could help: 我真的不知道如何旋转,但是以下内容可能会有所帮助:

Button rotateButton = (Button)findViewById(R.id.rotate_button);
rotateButton.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {
                rotate();
            }
        });

protected void rotate()
    { 
       // see below links for rotating stuff.
    }

Try this , and this for rotating. 试试这个这个旋转。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM