小编Shi*_*han的帖子

Android上的相机方向

你好朋友.我正在创建一个使用相机代码的Android应用程序.我用过android-API 2.1.我在戴尔手机上安装了我的应用程序,相机的方向是正确的.但是,我在三星Galaxy S2等其他Android手机中安装了我的应用程序.这里,问题在于相机方向,即使在纵向模式下相机旋转90度.任何人都可以建议我是否需要更改任何相机参数,以便相机方向适用于所有手机...?这是我的代码:

//class CameraDemo
public class CameraDemo extends Activity {
private static final String TAG = "CameraDemo";
Camera camera;
Preview preview;
Button buttonClick;
Button next;


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
try
{

super.onCreate(savedInstanceState);
setContentView(R.layout.camdemo);

preview = new Preview(this);
((FrameLayout) findViewById(R.id.preview)).addView(preview);

buttonClick = (Button) findViewById(R.id.buttonClick);
next = (Button) findViewById(R.id.next);
buttonClick.setOnClickListener( new OnClickListener() {
public void onClick(View v) {

preview.camera.takePicture(shutterCallback, rawCallback, jpegCallback);

try{

Constants.takepic=1;

buttonClick.setEnabled(false); //once click is clicked, its disable …
Run Code Online (Sandbox Code Playgroud)

camera android orientation

5
推荐指数
1
解决办法
5125
查看次数

标签 统计

android ×1

camera ×1

orientation ×1