surfaceview

The ideal surfaceView Camera orientations and proportions (avoiding preview stretching) - android

↘锁芯ラ 提交于 2019-12-23 05:59:39
问题 I've started a project which contains of a camera surfaceView (used in order to live image preview on the screen) from beginning I thought it shouldn't be much problems in implementing this, but for now I've got stuck within the part concerning the preview orientation and it's proportions, I've been searching Stack's topics about surfaceview orientations and stretching issues but I couldn't get a good result out of them at all. What I would like to do is to obtain preview in the same angle,

SurfaceView appears empty, nothing being rendered

时间秒杀一切 提交于 2019-12-23 05:25:30
问题 I'm trying to draw some shapes onto a SurfaceView from within a thread, but nothing is being rendered to the screen. I've looked at similar questions by people having the same problem, but none of the answers have led me to a solution, suggesting a different cause in my particular case. I've created a simplified version of my code to demonstrate the problem. Rendering is handled by the RenderingTestView class, which implements a custom view derived from SurfaceView. The rendering thread is

How to show Admob in SurfaceView

六眼飞鱼酱① 提交于 2019-12-23 04:45:42
问题 I try to show Admob on my SurfaceView. I use framework from book beginning android games from Mario Zechner In framework there is a class (AndroidFastRenderView extends SurfaceView implements Runnable) and in that class there is line canvas.drawBitmap(framebuffer, null, dstRect, null); where framebuffer is Bitmap where is all drawn in game. In that framework there is a class (AndroidGame extends Activity) where is line setContentView(renderView); Here renderView is AndroidFastRenderView that

Android - Drawing on thread

纵饮孤独 提交于 2019-12-23 03:46:10
问题 I want to draw something repetitivelely each 100 milliseconds or when a button is pressed. For the button onclick event it works right, but I can't make it work in a thread. Following is the code: onclick button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Draw(); } }); thread private Handler handler = new Handler(); private Runnable runnable = new Runnable() { public void run() { Draw(); handler

How to place UI widgets on top of multiple Z ordered Surface Views in Android

喜夏-厌秋 提交于 2019-12-23 02:53:13
问题 I have 2 SurfaceViews and 1 button and they need to be arranged in a way similar to the attached screenshot. I was able to get SurfaceView B to be on top of SurfaceView A by calling surfaceViewB.setZOrderOnTop(true); The problem is that, once I do that, SurfaceView B is placed above the actual Window and I'm no longer able to get the Button to be on top of it (eg. calling button.bringToFront() is useless here). Any idea how this layout could be accomplished? 回答1: You can use

Is it possible to render two video streams simultaneously on a single SurfaceView?

谁说我不能喝 提交于 2019-12-23 02:01:50
问题 Is it possible to render two video streams simultaneously, using different "sections" of a single SurfaceView ? I have made sample code that renders two videos simultaneously using two SurfaceViews side-by-side, but I am wondering if it is possible to have both videos play on the same SurfaceView . Using a MediaPlayer , you can set either the SurfaceHolder or the Surface itself as the display. I believe the code to achieve what I am asking would be inside of the surfaceCreated method:

Scaling bitmaps on SurfaceView = no antialiasing?

▼魔方 西西 提交于 2019-12-23 00:23:11
问题 I am trying to scale DOWN a high resolution .png bitmap on my SurfaceView canvas like so: Bitmap player = BitmapFactory.decodeResource(getResources(), R.drawable.player); Paint paint; paint.setAntiAlias(true); paint.setDither(true); paint.setFilterBitmap(true); paint.setFlags(Paint.ANTI_ALIAS_FLAG); //then in onDraw: canvas.drawBitmap(player, null, frame, paint); The problem is that the antialiasing works perfectly when I use a View, but it fails to work when I use a SurfaceView, and the

Z-order issue with MediaCodec and TextureView

痴心易碎 提交于 2019-12-22 21:26:07
问题 In my Android app I have the need to render three views with the following Z-order: At bottom, the output surface of a MediaCodec decoder covering the whole screen. I have the requirement that I have to transform the image produced by MediaCodec (e.g. scale it) In the middle, a GLSurfaceView (or other surface/view running GL shaders I define), covering the whole screen. Obviously some of the pixels in this layer will be transparent, in order to see the MediaCodec output beneath. On top, any

Why is a SurfaceView in a Fragment still visible when the Fragment is hidden?

落爺英雄遲暮 提交于 2019-12-22 21:13:12
问题 Just a general question: I have a Fragment which has a SurfaceView. When I hide the Fragment by the FragmentManager, the SurfaceView is still visible. I found a workaround by just setting the View to INVISIBLE/GONE/VISIBLE when the Fragment is hidden/visible - but I'm wondering: Why is the SurfaceView still shown? Is it because the SurfaceView basically is a "punched hole", which means, it's not in the Layout-Hierarchy of the Fragment and therefore can't be hidden when the Layout is hidden?

Custom Android Camera Application, Camera Preview Issue

梦想的初衷 提交于 2019-12-22 18:34:06
问题 the camera preview is showing a distorted image, which is elongated while in portrait mode and flattened while in landscape. I have already resized preview with a million techniques. Then I read somewhere it must be something with resizing the SurfaceView . But so far I have not found anything suitable. This is my activity.java file: public class CameraActivity extends Activity { private Camera mCamera; private CameraPreview mPreview; private FrameLayout preview; private static final String