0
我想我的活动背景是相机(后退)视图,我到目前为止试图添加一个surfaceView,但没有运气,我发现的教程是打开相机应用程序。 P.S-我想在SurfaceView/Camera上添加更多的资源。 & 我不想点击图片只预览 由于我没有任何代码显示,因为它们不是我需要的,所以这里是,虽然它可能没有必要。添加一个相机预览
我想我的活动背景是相机(后退)视图,我到目前为止试图添加一个surfaceView,但没有运气,我发现的教程是打开相机应用程序。 P.S-我想在SurfaceView/Camera上添加更多的资源。 & 我不想点击图片只预览 由于我没有任何代码显示,因为它们不是我需要的,所以这里是,虽然它可能没有必要。添加一个相机预览
你有没有试过类似的东西?
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<SurfaceView
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--views on top should come after the surfaceview,
at the same level in the view heirarchy.
this gives them a higher z-index (i.e. drawn afterwards)
... you could also use a RelativeLayout as the root view -->
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"/>
</FrameLayout>
我已经应用了代码,我会尽快让你知道,而且这个简短代码会创建一个没有任何java类编程的预览? – Anonymous
顺便说一句,它只是显示一个黑屏 – Anonymous
不,对不起,这是一个布局的例子,你必须在onCreate()的活动中充气,以便你可以将视图放在相机背景上。表面视图需要显示从相机接收到的帧。也许这个教程可能会有所帮助:http://blog.rhesoft.com/2015/04/02/tutorial-how-to-use-camera-with-android-and-android-studio/ – maturecheese