我使用下面的意图裁剪从图库中选择或采取摄像机的图像:如何将旋转按钮添加到Android图像裁剪屏幕?
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");
不过,我需要旋转按钮添加到屏幕为好。有没有办法做到这一点?
在此先感谢。
我使用下面的意图裁剪从图库中选择或采取摄像机的图像:如何将旋转按钮添加到Android图像裁剪屏幕?
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");
不过,我需要旋转按钮添加到屏幕为好。有没有办法做到这一点?
在此先感谢。
你不能这样做。因为您正在谈论的活动不是您的活动。
如果你真的需要这个,你将不得不实现自己的裁剪功能。找到与AOSP裁剪类相对应的类,并在需要时重用它。
试试这个:在一个正常的按钮上设置一个onCLickListener
,并在其中执行您的rotate function
。我真的不知道该怎么旋转,但下面可以帮助:
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.
}
但我怎样才能将该按钮插入到我没有实现的活动? – ipman
您是从图库中获取图像还是拍摄新图像然后裁剪?根据这个动作,如果你从图库中提取图像进行裁剪,那么我认为你不必为旋转按钮创建一个新的活动。我认为你可以设法在相同的活动中修复它。 – Ghost
我在Android上使用默认的作物活动,就像[this]中的那样(http://stackoverflow.com/questions/1973359/android-crop-an-image-after-taking-it-with-camera-with- a-fixed-aspect-ratio)问题 – ipman