surfaceview

Custom main menu with rotating android

末鹿安然 提交于 2019-12-08 05:32:23
I would like to make an application with a custom main menu. However, I want to have a different menu, with a circle and items around it. The user can select each item rotating the device. Should I use a Surface View to draw them and make the animation or there is an easier way for that ? Yes, you should draw the background and the text using a surface view. You will need to rotate the background and the text when the device rotates. This is a fairly simple way to implement it. The rotation is probably the only hard part. Just make a small version to test the code of the main functionality and

Camera Preview does not appear full screen(displayed in a box)

妖精的绣舞 提交于 2019-12-08 02:41:49
问题 I would like to use a custom camera to take pictures of a lesser size than the preview,I have heard that maintaining the aspect ratio is very important.I have used the PreviewFrameLayout in AOSP ICS.I have found that the SurfaceView only displays at the center of the activity in a box and does not fill the entire screen. public class PreviewFrameLayout extends RelativeLayout{ static final String TAG="PreviewFrameLayout"; public interface OnSizeChangedListener { public void onSizeChanged(int w

SurfaceView sample code

馋奶兔 提交于 2019-12-08 02:15:00
问题 I need a sample tutorial for the android SurfaceView , or sample code using it that can be shared. The API demos are difficult for me to understand. Does anyone have alternatives? 回答1: This commit of my WorldMap demo app shows you the changes necessary to convert from an android.view.View to an android.view.SurfaceView with an android.view.SurfaceHolder.Callback. It cheats a bit by using the View 's onDraw() from within the SurfaceView 's DrawThread and by calling the View 's onSizeChanged()

SurfaceView or TextureView combination

吃可爱长大的小学妹 提交于 2019-12-08 01:12:14
问题 I am trying to apply real-time effects to camera preview and show in multiple views , how can I do? (just like the camera2) (snapshot) I know 2 approaches to show real-time effects on camera preivew if no ScrollView involved on the left side. Use GLSurfaceView and setRenderer. Bind SurfaceTexture as GLES external texture, and use GLSL(OpenGL Shading Language) to apply effects. Use TextureView. It is more complex because need to setup EGLContext/EGLSurface and do thread management. However, I

How to scroll off screen memory bitmap

北城以北 提交于 2019-12-07 23:48:00
问题 Using below code to scroll I have a Surfaceview thread and an off canvas texture bitmap that is being generated (changed), first row (line), every frame and then copied one position (line) down on regular surfaceview bitmap to make a scrolling effect, and I then continue to draw other things on top of that. Well that is what I really want, however I can't get it to work even though I am creating a separate canvas for off screen bitmap. It is just not scrolling at all. I other words I have a

Set rotation and position of bitmap

最后都变了- 提交于 2019-12-07 20:43:24
问题 I would like to know how i both can change the position of a bitmap and at the same time rotate it. Im drawing at a canvas. Im currently using this line of code: canvas.drawBitmap(bitmap, posX, posY, paint); and I think using a matrix for rotation is the best option? The problem is that the line of code, posted above, doesn't take a matrix but a position. There is also a similar line of code: canvas.drawBitmap(bitmap, matrix, paint); This one takes a matrix but not a position. How should I do

Strange behaviour with Camera and SurfaceView

孤街浪徒 提交于 2019-12-07 19:32:26
问题 I'm going crazy with the use of SurfaceView. I've developed an app which takes pictures at fixed time intervals. It works well with my device with Androd 2.3. Here is a sample code: public class MainActivity extends Activity { private Camera mCamera; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button captureButton = (Button) findViewById(R.id.button_capture); captureButton.setOnClickListener( new

Capture screen of SurfaceView

戏子无情 提交于 2019-12-07 19:19:49
问题 In above image i have one SurfaceView and one Button named Capture . SurfaceView is showing camera preview. So, I want screenshot of surfaceview when i click on Capture button. I had tried many examples and answers but none of them works. I just get Black Screenshot image . In some posts i also found it is impossible to take screenshot of surfaceview . So please help me any alternative solution with example. Here are some answers I already seen: how to create and save a screenshot from a

Rendering camera into multiple surfaces - on and off screen

北城余情 提交于 2019-12-07 15:24:22
问题 I want to render the camera output into a view and once in a while save the camera output frame to a file, with the constraint being - the saved frame should be the same resolution as the camera is configured, while the view is smaller than the camera output (maintaining the aspect ratio). Based on the ContinuousCaptureActivity example in grafika, I thought the best approach would be to send the camera to a SurfaceTexture and generally rendering the output and downscaling it into a

ANR in SurfaceView method “onTouchEvent(…)” on Android

北慕城南 提交于 2019-12-07 12:06:41
问题 On Android, I've subclassed SurfaceView and the resulting view is working fine in most cases. However, roughly 1% of all users report an ANR problem with this implementation. Apparently, there's an edge case where the SurfaceView fails due to some problem, probably a deadlock. Unfortunately, I don't know what's wrong with my implementation of onDraw(...) and onTouchEvent(...) or how to improve the code. Can you help? "main" prio=5 tid=1 MONITOR | group="main" sCount=1 dsCount=0 obj=0x41920e88