surfaceview

How to make a rounded surfaceview

天涯浪子 提交于 2019-12-09 03:29:18
问题 I'm trying to make a rounded shaped surfaceview. I've searched a lot but i couldn't find a good solution. what i'm doing right now is that, I've put the SurfaceView into a FrameLayout, then another View on top of it, either with a PNG mask, or a shape xml drawable. here it is <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1" android:layout_width="fill_parent" android:layout_height="fill

is canvas in android proportional on different devices

末鹿安然 提交于 2019-12-08 22:33:51
问题 I am trying to make an app using canvas and a surfaceview, and I am worrying that in the future I would have many problems with it because I am not sure if the canvas is proportional with every device. currently I can only use my emulator since my phone's usb cable doesn't work(I know.. I have to get a new one..). anyways, i would like to know if the canvas would transfer my coordinates and make everything proportional, what I mean by that is that if i have something in point a, lets say (10,

SurfaceView draw performance

梦想与她 提交于 2019-12-08 20:48:27
I am writing a test application using Android SurfaceView. I want to see if it is a viable approach to 2D game development. At the moment performance is not too great. There seems to be tiny little jerks and slowdowns every 15 or so seconds. I am only drawing about 30 rectangles on screen. I would hope it would be able to do this with ease. I decided to profile performance. I log the average draw time every 10 frames. What I have noticed is that it goes periods with good draw times, and then it jumps up. I am certain my code does not allocate memory in the game loop, so I think this problem is

Android: from surfaceview back to the menu

坚强是说给别人听的谎言 提交于 2019-12-08 11:56:39
问题 I am making a simple game in which I draw a set of bitmaps on a Canvas on SurfaceView. Now in my main activity I have a LinearLayout where I have designed a button. In the onClick() of this button I write: setContentView(new surfaceviewclass(this)); it works fine. It opens the SurfaceView and I play the game etc. But I want to see the button again where I started from I mean when the game is over I want the menu to reappear.. I have already tried calling the void like main.menu(); but the app

How to set background to the outer portion of frame in android using surfaceview

浪子不回头ぞ 提交于 2019-12-08 11:56:10
问题 Hello guys, My problem is how can I fill the outer portion of the frame. I need to show the camera moments inside the frame only. The rest of the portion will filled up with the color what we choose to fill. Here this is the whole background captured from the camera but I don't want this. Please suggest me what I should do? Your true guidance and support will be additional and your efforts will highly be appreciated once you're sure to done with this. 回答1: You have two options if you don't

Custom main menu with rotating android

痞子三分冷 提交于 2019-12-08 10:00:49
问题 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 ? 回答1: 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

Implement a ImageView to a SurfaceView

前提是你 提交于 2019-12-08 09:35:41
问题 I have one small question... Is it possible to implement a ImageView inside a SurfaceView , or to create a ImageView inside the SurfaceView And if so could someone point me in the right direction on how to do it. 回答1: I did this in code with a TextView, but you could just change text view with ImageView. My TextView is a small bar across the top, hence the changing parameters. params = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT

Animation ist only smooth when ontouchevent is called

跟風遠走 提交于 2019-12-08 09:29:07
问题 i'm making my first 2d sidescroller game using a surfaceview and a canvas to draw things on (a lot of primitives put in different path objects). my game loop uses fixed timesteps with linear interpolation. i don't create any objects during the game. i've been improving my code for 3 weeks now, but my animation is still not all the time smooth. it's ok, but every few seconds there are a lot of little hicks for about 1 or 2 seconds. what i recognized is when i move my player (this means

SurfaceView draw performance

删除回忆录丶 提交于 2019-12-08 07:44:55
问题 I am writing a test application using Android SurfaceView. I want to see if it is a viable approach to 2D game development. At the moment performance is not too great. There seems to be tiny little jerks and slowdowns every 15 or so seconds. I am only drawing about 30 rectangles on screen. I would hope it would be able to do this with ease. I decided to profile performance. I log the average draw time every 10 frames. What I have noticed is that it goes periods with good draw times, and then

Two layers, but can't show the bottom layer in android

落花浮王杯 提交于 2019-12-08 06:23:43
问题 I am working on an Android project similar to a scratch card. I have two layers in RelativeLayout. Bottom layer contains an ImageView, and top layer contains a SurfaceView. The problem is the display stays black and doesn't show the ImageView even if I set canvas.drawColor(Color.TRANSPARENT) . What should I do if I want to scratch and erase the part of SurfaceView and reveal the ImageView below? Thanks in advance. And I am sorry for the bad English. Here's my layout: <?xml version="1.0"