Draw on top of a "View"? - android

I am developing an application in which each Activity has a View which shows a PNG Image, followed by a TextView, an EditText and other views... The Activity's Content View is inflated using an XML layout file.
Depending on which options the user chooses/how he interacts with the application, I want to dynamically draw onto the PNG Image.
Is this possible? If so, how? If not, how else could I go about it? Could you point me towards a tutorial on this sort of thing?
Many thanks
Darius

Related

Tap Draw On a Section of the Screen?

I'm trying to make my app be able to draw with your finger like Snapchat on part of the screen but not the whole thing? Every example I have seen of drawing is just an app that turns your whole screen into the canvas and does nothing else but I'm having a hard time implementing it as just part of my app. So as well as how to just choose a section of the screen as the canvas is it possible to make another activity just like the examples that extends view that I include or can I put everything in MainActivity.java?
Yes, there is. You can create a fragment, or as many as you want, and them place the fragment(s) wherever you want in the activity by using some of the available layouts.
For example, you can use a relative layout. You can add a frame layout to the relative layout and align it in the activity where you want, set its size, and then add the fragment to it. You can check this link to learn about fragments and their usage if you don't know them.

I want buttons which change the screen to another screen on canvas

I already had buttons on my original app but now I created an image on canvas in Android and have combined the two together, however I cannot view the buttons on the page but can only see the image on the page. These buttons were designed to move to different pages. Does anyone know how this can be done. I have also used extend Activity instead of View/SurfaceView is that ok or will that be causing the problem?
Thanks.

Layout for MapView

Hello there android experts, I have a problem for some time and after some workaround, I can't achieved what I want.
I just want to have a layout (not sure what the name of it) that is similar to the Map application on android:
Here's the image of the layout:
How to achieve / call this kind of layout if you are in a MapView?
Is it possible?
Based on examining this in Hierarchy View, it would appear that your panel is a separate activity, themed with a translucent background so the underlying activity shows through.

How do I go about making this layout? Having so much trouble

I am trying to make a really easy xml layout and I can't seem to get it to look the way I want.
I attached a picture of what I want it to look like:
Basically, I have a static background image in my imagebutton at the top. Below that I have a picture the user snapped in the Photo Box. I assume I need an image view for that, but would it be possible for me to instead pass the pic to the background of an image button too so I can make the size easier to manage?
Based on what the user chooses in the options before this layout, an option photo is shown based on what they select. The photo would display to the right of the centered image, if that option is selected.
Below that would be a centered text view, with another separate one below that. Finally, I would have two buttons on top of each other at the very bottom.
Could someone show me a good way to get this layout and also tell me if it is possible to take a picture that is snapped and make it the background of an image button - or if that is a bad idea?
Thanks so much!
Seems like for the most part, you just want a simple LinearLayout. For the part with the photo, you could use an embedded LinearLayout or RelativeLayout.
As for the picture - you can easily set the background of any view or view group to any image (any view has an option to set the drawable for the background).
The only thing you should consider - for the purposes of making the UI more intuitive - is to slightly modify the image for the different states (focused, selected, etc), so that the user gets visual feedback when selecting the button via the trackpad, or when clicking on the button. A "drawable" has built-in support for multiple images for each state.

Positioning elements outside an Activity on Android

Is there a way to absolutely position an UI element on Android so that it is located outside an Activity? For example: can you create a fullscreen ImageView simply by moving/resizing an ImageView inside an existing regular Activity instead of creating a new fullscreen activity?
EDIT: Re-reading my question I see I wasn't very clear about what I'm trying to accomplish. I'd like to temporarily extend an element to cover the notification bar at the top of the screen. I need to create a semitranslucent fullscreen overlay but since translucent activities cannot cover the notification bar I'm trying to find out if it's possible for an element to break out of activity's bounds and resize itself to fill the whole screen, top to bottom.
That depends on what specifically you're trying to do. You can easily draw graphics offscreen and then animate their movement into the screen using a Canvas, but this is more for graphics than for user-interface elements. For moving buttons or such, you can have a look at another question here "How to position View off-screen". I gave a brief intro on how to use canvases, but the questioner found another way to do it using a customised linear layout and view animations.
Lastly, if you're trying to zoom and scroll an image around that's larger than the ImageView, there are some sources you can look at for inspiration. I realies this isn't strictly your question, but I'm including it since it might be linked to what you're thinking about. You can find a tutorial on Anddev.org and an open source app on Google Code.

Categories

Resources