Can you draw layers over an AdView? (opnenGL/libgdx) - android

I'm making sort of a drawing program and using admob to get some earnings :)
So what I want is when the user draw a line over the AdView it renders over it and not under. Is it possible or complete crazyness?

this is likely against the Admob TOS: http://support.google.com/admob/answer/1307237?hl=en
". Ads should not be placed in areas where users will randomly click or place their fingers on the screen."
...i know as ad advertiser, i would not want anything covering my ads

Related

Can you draw over Facebook chat heads on Android?

I have an app that draws an overlay. However, the Facebook chat heads are always drawn over the top of my overlay. I have tried re-drawing my overlay every second (obviously I wouldn't do this in the final app) but the chat head just stays on top, there isn't even any flicker giving a clue that it's being re-drawn. I would expect the last overlay drawn to win and end up on top so unless Facebook is redrawing at a ridiculous rate what are they doing? Any ideas? Thanks.
I fixed it by setting the type in the layout params to TYPE_APPLICATION_OVERLAY for Oreo and later and to TYPE_SYSTEM_ALERT for pre-Oreo.

Scrolling home screen in LibGdx

I am using LibGdx to develop a game. For Now I am not using scene2D. I am struck up in increasing the levels of the game as I do not have the scrolling screen.
I like to design a a scrolling screen as it is in many games which are level based (for ref, lets say Candy crush). Could you please point me a example on how to have such a scrolling screen to show a bigger area where I can show many levels.
Thanks is Advance !
Using the Scene2D function is not necessary for this and is more for GUI implementation and different screens. The Scroll pane really shines when creating reading content that does not fit your phone. I do advice to start learning Scene2D to create MenuScreens and UI though.
What Candy Crush "simply" does is having multiple backgrounds that are placed next to each other and tile seamlessly. They use buttons in the correct place for levels. By dragging a finger across the screen the camera will move in that direction. For the movement from one level to the next there is probably something like a spline in play.
It is important only to draw the background tiles and buttons that are actually visible on the screen if you have many. Since these have fixed positions and you know your camera area and position you can calculate what to draw and what not. Just drawing everything each frame is likely to slow down your fps.
You can do a search on:
Tilemaps, for you backgrounds but you probably want them in just one direction so a simple 1D array would suffice.
Dragging, to move your camera. Here I gave a basic explanations on how I do it.
Splines, are a bit tougher and you do not really need them. They could be used to animate or move something along a curve.
Thats all, expecting you know how to create something like a button (click a sprite).

set the origin (x,y) of a view inside of a RelativeLayout

I have some game pawns on a screen inside of a RelativeLayout. When the user clicks the pawn I would like then to be able to drag it under there finger. I have the MotionEvent captured but can't seem to find how to adjust the orion of the pawn.
I've seen posts saying to adjust the margin but that seems questionable. I still want to do hit tests for the pawns after they've been moved and don't understand how to work with the margins in that case.
thanks!
I would recommend not using a Relative Layout at all.
A Canvas is a much better option
Or if you really want to use a layout, possibly an AbsoluteLayout is a better option
Using a layout for a game may prove unsatisfactory as you proceed. I can recommend using the free and open source game engine AndeEngine for making 2D games. The problems you have with collision detection and x,y positioning are trivially easy to implement with it. I've made 2 games and a visualization view within an app with is so far.
Check it out here:http://www.andengine.org/
You can download the demo app to your android device and see its out-of-the-box capabilities. (They include Sprites, sound, animation and more.)
This one game I made with it.
https://market.android.com/details?id=com.plonzogame&hl=en

App not displaying correctly on Samsung Transform

My game, Hidden Treasures, has been on the market over two months now. Recently a customer presented a new problem that has never happened before.
According to the customer,
In their words:
"There was a diagonal line across it, and it was like
the image was backward so that the right side of the line showed what
was supposed to be on the left, and the left side showed what was
really on the right. Like if you switched them, it would show the
proper image. The image itself is slanted as well (from top left to
bottom right, at the same angle as the division line)"
I have never heard of this before, and have no idea how to fix it.
The app is a hidden object game, it uses a canvas for all the drawing as I did not know OpenGL ES at the time I made this game.
Basically, its got two bitmaps,
the size of the screen,
1680x1050.
It draws a chunk from the big one onto the small one, then it draws all the hidden objects over that, then displays it to the screen.
I don't understand how it could even mess up at all. Its drawing a screen sized image to the screen, and it doesn't happen on any other phone to my knowledge.
Any ideas? It doesn't force close so I don't have a stack trace

Showing the Google Maps reticle on Android

I'v encountered a problem with Google Maps on Android. In my app I have a location-chooser where the user navigates to his desired location to save the exact street location. In order for the user to actually see what street he is no (and not just the general area) I need to mark the middle of the map clearly.
The problem is that the reticle (the little circle marking the center) from Google Maps usually won't show. It appears at the most 1 out of 10 times I open the map, probably less. This happens regardless if I add other overlays or if I just show the map as is. I am aware of ReticleDrawMode and have tried setting it to DRAW_RETICLE_OVER, but this does not seem to work (and it should be the default already).
Have I missed something here? I have searched for the problem and from what I have see the problem seems to be common, but I havn't seen a solution for actually forcing it to always show, only for hiding it.
If the reticle is broken, does anyone have a good suggestion for how to create a custom one? As I said the the user will navigate the map, so I can't just do a normal overlay on a fixed point of the map, and the map also does not take up the full screen so drawing something over it is a bit ugly (although I guess that will be my last resort).
And of course I found the answer just after I asked the question, or at least part of the answer.
I haven't found out how to get the reticle to work, but the easy workaround for this is to use the fact that different widgets can overlap each other in a RelativeLayout, whichever is declared last will simply lay above the other. So I ended up putting the MapView in a RelativeLayout and then simply placing a TextView in the center of the same layout. The TextView is now over the center of the map and can be used to mark the middle.
(Going to replace the TextView with something more appropriate later, but the concept stays the same).

Categories

Resources