|
|
|
@ -4,6 +4,7 @@ import android.annotation.TargetApi; |
|
|
|
|
import android.content.Context; |
|
|
|
|
import android.graphics.SurfaceTexture; |
|
|
|
|
import android.support.annotation.NonNull; |
|
|
|
|
import android.view.LayoutInflater; |
|
|
|
|
import android.view.Surface; |
|
|
|
|
import android.view.TextureView; |
|
|
|
|
import android.view.View; |
|
|
|
@ -20,7 +21,8 @@ class TextureCameraPreview extends CameraPreview<TextureView, SurfaceTexture> { |
|
|
|
|
@NonNull |
|
|
|
|
@Override |
|
|
|
|
protected TextureView onCreateView(Context context, ViewGroup parent) { |
|
|
|
|
final View root = View.inflate(context, R.layout.texture_view, parent); // MATCH_PARENT
|
|
|
|
|
View root = LayoutInflater.from(context).inflate(R.layout.texture_view, parent, false); |
|
|
|
|
parent.addView(root, 0); |
|
|
|
|
TextureView texture = root.findViewById(R.id.texture_view); |
|
|
|
|
texture.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() { |
|
|
|
|
|
|
|
|
|