相关疑难解决方法(0)

Android API版本兼容性

我想我的应用程序可以在Android版本2.1和2.2上运行.在我的应用程序的一个区域,有一个肖像风格的相机 - 在两个操作系统版本上制作肖像相机预览的过程是不同的(据我所知).方法如下:

2.1:

Camera.Parameters parameters = camera.getParameters();
parameters.set("orientation", "portrait");
camera.setParameters(parameters);
Run Code Online (Sandbox Code Playgroud)

2.2:

camera.setDisplayOrientation(90);
Run Code Online (Sandbox Code Playgroud)

setDisplayOrientation(int)方法在API Level 8(2.2)中可用,因此不能在2.1上使用; 但是,使用2.1(Camera.Parameters)方法不会在2.2上正确旋转预览和图像.

这种不兼容性存在似乎很奇怪 - 是否有更正确的方法来实现这一目标,这将允许我针对这两个平台?

compatibility camera android rotation

8
推荐指数
2
解决办法
3619
查看次数

强制相机始终在Android中以纵向模式打开

是否可以仅在纵向模式下在Android中打开Camera Intent,即使用户翻转设备,相机仍将处于纵向模式,

我尝试了以下答案:强制人像模式,但没有工作,谢谢

android android-intent android-camera

6
推荐指数
1
解决办法
1万
查看次数

如何设置相机图像方向?

在我的应用程序中,我添加了图像上传功能,它可以很好地处理除了摄像机图像之外的所有图像,每当我从图库中浏览摄像机图像和纵向图像旋转90度时.以下是我的代码片段..有人可以帮我吗?我遵循了很多教程但是所有这些教程在kikat中工作得很好..但是当同一个教程不适用于ics,软糖等时..

public class MainActivity extends Activity {
private Button browse;
private String selectedImagePath="";
private ImageView img;

private TextView messageText;

private static int SELECT_PICTURE = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    img = (ImageView)findViewById(R.id.imagevw);
    browse=(Button)findViewById(R.id.browseimg);
    messageText  = (TextView)findViewById(R.id.messageText);
    browse.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
             Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE);
        }
    });
}
 @Override
   public void onActivityResult(int requestCode, int resultCode, Intent data) {
       if (resultCode == …
Run Code Online (Sandbox Code Playgroud)

android android-camera android-camera-intent

3
推荐指数
1
解决办法
1万
查看次数