如何在Android相机中获取对象(图像)的长度,高度?

时间:2014-03-19 08:37:31

标签: android camera measurement

我是相机的新手,我想使用Android相机获取原始对象的长度和高度。我尝试了下面的代码:

double d22 = angle_of_top_object;
double d12 = Math.tan(Math.toRadians(d22));
Log.d("angle", roll_angle + "");
double d23 = 15 * d12;
tv.setText("Length:"+new DecimalFormat("##.####").format(d23)+" cm ");
Toast.makeText(CameraTestActivity.this, tv.getText().toString(), Toast.LENGTH_SHORT).show();
Log.i("Length", tv.getText().toString());

1 个答案:

答案 0 :(得分:0)

你可以像这样使用并获得这样的值...... 你只是

添加您的视图名称,如Imageview,TextView等 ...

int ht = viewName..getLayoutParams().height;
int ht = viewName..getLayoutParams().width;