Advertisements:




Drawing Viewgroup Content On Surfaceview / Surfaceholder Canvas


Wanted to know if its possible to draw viewgroup contents on surfaceview/surfaceholder canvas?  I'm trying to achieve fast 2d animation (using surfaceview) alongside android ui components on the screen. Since surfaceview punches a hole in the app window, i tried creating surfaceview, and inside there i created linearlayout and added couple of controls (button and imageview). Now i tried calling mlayout. Draw (canvas) from surfaceholder canvas, it doesn't render anything. Am i missing something here?

I wonder if that would yield better performance then calling invalidate from activity. Runonuithread().


View Full Post With 2 Replies

Related Forum Messages:

Please Follow Index to Quick Jump to the Message.


Notification When Any Child Of A Viewgroup Done Drawing

I am trying to figure out if there is a way to be notified when any child of a viewgroup has done drawing. I tried using the viewtreeobserver's predraw listener which works great if i know a child is about to get drawn, but i am looking for an equivalent "postdraw" or "ondrawdone" callback.

Posted On: Jun 28 . View Related Posts . . View 2 Replies .

Drawing Through Canvas Class Hardware Accelerated On Droid?

Are calls to canvas. Drawpath()/drawarc()/etc hardware accelerated, passed
To a device native implementation or implemented in java?

Or is opengl the only way to achieve hardware accelerated drawing?

I am trying to determine if it is feasible to use the canvas api for
Realtime animation.


Posted On: Aug 7 09 at 7:08 . View Related Posts . . View 2 Replies .

Make Surfaceview Insensitive To Touch Events

When i am running mediaplayer, i want the surfaceview to be insensitive to motion events. I tried msurfaceview. Setfocusableintouchmode(false); but its not working. Please guide me in this.

Posted On: (1 user) Mar 10 2009 . View Related Posts . . View 3 Replies .

How To Use Custom Android Viewgroup In Xml

I have a class that extends framelayout called noteview. It is a top level public class.

It works just fine when i'm creating the ui from java code, but i can't figure out how to use it in xml. I tried inserting the fully qualified class name just like i would for a custom view, but i get and exception classcastexception: android. View. View cannot be cast to android. View. Viewgroup when activity tries to inflate the xml.

I have only been able to find tutorials on custom views, not custom viewgroups. What do i need to do to use a noteview just like i would a framelayout in an xml layout?

For example: this works

Code:.

But this throws the above exception:

Code:.


Posted On: Jul 10 at 18:53 . View Related Posts . . View 1 Replies .

Protected Member Variable Mscrollx Not Accessible To Subclasses Of Viewgroup

In the android launcher app, workspace. Java accesses the mscrollx member variable.

http://www.google.com/codesearch/p?Hl=fr&sa=n&cd=2&ct=rc#4r7janm0eqe/.

However it looks like mscrollx is not accessible to my viewgroup subclass.

Eclipse is marking it as unresolved().

Why is it that launcher's codebase can access it whereas custom subclasses cannot ?

And what can i do to set the mscrollx with the scroller's current x position ?


Posted On: Oct 2 2009 . View Related Posts . . View 5 Replies .

Viewflipper Animations And Drawing Cache

I have a viewflipper which i use to animate between views. The in/out- animations are tranlateanimations. During the animations, the views that are animated are covered by a darker transparent foreground. How can i get rid of this?

Further, if the view thats being animated contains layout child with a background image set, the image looks really bad during the animation. I also have the same problem when animating with a textswitcher. Strange thing is that the apidemos does not have this problem and i am basically using that same code. Are these optimizations set on a global level?


Posted On: Mar 21 . View Related Posts . . View 2 Replies .

Skia And Paint Drawing Objects And Their Use Or Documentation

Does anyone know of good documentation for the skia drawing library used by android? The main canvas object has hardly any state, so i'm thinking especially of the objects you can embed into the paint object. I've worked out by trial and error how to use some colorfilters and made a cool effect with colormatrixcolorfilter. Now i have the drop shadows i want from the lineargradient shader also. I think i understand patheffects and have some ideas about xfermodes. Maskfilters and rasterizers are still utterly opaque to me. But trial and error is not a good way to understand a complicated library.

Mostly i'm concerned that the android docs don't discuss 2d graphics and the means of using them at all. Even the class javadocs often don't explain what the class is doing. The actual function is all in skia c code, which i can get, but it also lacks documentation. I've seen some cool demos but google explained little about how they were done. Is the only way to understand these things experimentation and reading the c code? What about efficiency and best practices? The davlik/android vm is sensitive to memory allocations and sometimes slow and i'm concerned that i'm not doing things the best way.


Posted On: Feb 8 at 18:43 . View Related Posts . . View 1 Replies .

Droid Currently Supports Hardware Acceleration For Skia 2d Drawing

I would like to know whether android currently supports the hardware acceleration for skia 2d drawing.

Posted On: Aug 4 2009 . View Related Posts . . View 4 Replies .

Relationship Between Surface And Canvas

What exactly is the relationship between a surface and canvas.

Posted On: Jul 30 at 9:28 . View Related Posts . . View 1 Replies .

Place Image In Rectangle In Canvas

In canvas we have drawrect() method for drawing rectangle. But now i want to fill it with image view. For this what can i do.

Posted On: Aug 18 at 13:36 . View Related Posts . . View 1 Replies .

Clear A Transparent / Translucent Canvas

I am painting some bitmaps onto a transparent canvas, so it is rendered above the system screen.

When i draw the next bitmap, i cannot clear the previously drawn one. How can i "erase" it?

If i could capture the initial canvas would be fine. Because i could paint always that before drawing the bitmap. But i am not succeeding on capturing it.


Posted On: Mar 12 2009 . View Related Posts . . View 5 Replies .

Use Drawarc Command For Canvas Class

I'm trying to create a customized clock that will highlight certain intervals that i choose (like a pie slice). I'm trying to use the drawarc command for the canvas class. However, it will only draw arcs of 360 degrees or more (full circles). I'd like to draw arcs of about 15 to 20 degrees or so. I have no idea what is wrong with my code. Can anyone figure out the problem? I know it's not being drawn behind my background because it will draw the full circle on top (you can just remove the background line of code).

My code for my activity and view class is below:

Activity class:

Code:.


Posted On: Feb 26 2009 . View Related Posts . . View 3 Replies .

Weird Bug In Canvas / Textview

Specially to all the android developpers. Well, let's go to the problem: i'm trying to rotate a webview according with the orientation sensor. That's because below this view i have a glsurfaceview wich i don't want to rotate, so as probably you'd have suppossed i set orientation in landscape mode, avoiding the automatic rotate of the cell.

To achieve my goal i include the class webview in another one using composition. This class is named, in example, extwebview and overrides the ondraw method with canvas. Rotate(-90) (after a translate). The class extwebview extends the linearlayout one. The problems begins when i decide set the webview in a non square portion of the screen (not the whole one). So i add the webview to the extwebview with "addview(webview, 200, 300);". In the main activity i add the extwebview with "addcontentview(extwebview, new layoutparams(layoutparams. Fill_parent, layoutparams. Fill_parent));" so it should being able to use the whole screen. And now come the problem. The rotated webview appears initially fine (rotated like expected), but if i slide my finger on it left or right (coords are changed and works like up and down, but that doesn't worry me) then only shows on the screen the portion of the view wich fits into the bounds specified in the webview with (200, 300). In other words, i rotate in the extvebview but it behaves like if i would the webview one (cutting the web page to its dimmensions).

However, that's not the only one surprise (not the most interesting one, at least for me). If i add a class wich extends textview in the main activity above the extwebview with the methods: setminwidth(300) and setminheight(300) (both of them inside the overrided ondraw method) then extwebview shows the whole page rotated exactly like expected, even behaves fine when sliding my finger on it, although the portion of the web which before wasn't showed and yes now becomes insensitive to my finger slidings. In a few words, with the setminwidth and setminheight methods the limits setted to 200x300 in the webview disappear. Is this a bug? Is there any other way of achieving this effect? I've been looking inside the code of the textview and i think the question it is in the requestlayout() method but i don't know where is implemented it's code.


Posted On: Feb 25 . View Related Posts . . View 4 Replies .

Create A Custom Shapped Button Using Canvas

Could i technically make a custom button using this class?

Posted On: Mar 25 2009 . View Related Posts . . View 4 Replies .

How To Draw Smooth / Dithered Gradient On Canvas

Several answers mention to use gradientdrawable. Setdither(true) to draw smooth gradients in android. That has no effect in my code. Any idea what i have to change to get a well looking gradient in my live wallpaper?

Posted On: May 29 at 22:29 . View Related Posts . . View 1 Replies .

Make Clickable Image Inside Canvas

I have create a canvas in android and inside that i have multiple bitmap images. Not i want to make these images click able.

I have tried following things so far.

I tried to add bitmap in image view as imageview has a setonclicklistner
But i think imageview can't be added into canvas , so i dropped this idea. Because even bitmap itself has no click events.


Posted On: Oct 13 at 9:39 . View Related Posts . . View 1 Replies .

Clip And Fill A Canvas Using An Alpha Mask

I'm relatively new to android development.

I have some .png icons that are alpha masks. I need to render them as an drawable image using the android sdk.

On the iphone, i use the following to get this result, converting the "image" alpha mask to the 'imagemasked' image using black as a fill code.

I'm not finding how to do the clipping on imagemasked using image.


Posted On: Jan 9 at 2:49 . View Related Posts . . View 1 Replies .

Textview Content Not Wrapping Or Scrolling

I have a simple textview that displays some text that i've scraped of the web. Despite the fact that the text i want to display is much longer than the width of the screen, it neither wraps nor gives me a scroll bar. It just stops.

My layout is configured as follows:

Code:.

Why this isn't displaying properly? What really simple thing am i missing?


Posted On: Aug 5 at 14:58 . View Related Posts . . View 1 Replies .

Tab Content Overlaps When I Try To Change It / Fix It

In my app the i have 3 tabs. When i try to change the tab, the tab content overlaps.

Same as image code.


Posted On: Jul 28 . View Related Posts . . View 8 Replies .

Way To Fit Content Of Webview Automatically To Screen?

When i load a url in my webview, the page always appears with full size and i am unable to zoom out (i did call setbuiltinzoomcontrols(true)). The webview is wrapped in a linearlayout with fill_parent for both dimensions.

Is there a simple way to fit the content of the webview automatically to the screen?


Posted On: Jul 30 . View Related Posts . . View 6 Replies .

Remove Window Titlebar After Adding Content

The question is quite simple "how do i remove the titlebar from a webview, after adding content ? Normally you use requestwindowfeature(window. Feature_no_title); but you can only use that method before adding content.

Posted On: Sep 23 at 12:09 . View Related Posts . . View 1 Replies .

Unable To See Full Content And Scroll Also - How To Show That

My code for the layout is given below. I am not able see the full content. I am not able to scroll also. How i can show the all content by scrolling.code.

Posted On: Sep 17 at 9:54 . View Related Posts . . View 1 Replies .

Motorola Droid - Copy All Content From One Sd Card To Other

So i want to move everything from my current 16gb sd card to my new 32gb sd card.

Is it as simple as copying all content from one to the other?
Can this be done with the phone on and connected to the computer?


Posted On: 07-21-2010, 02:43 PM . View Related Posts . . View 10 Replies .

Background On Layout Is Scrunching Contained Content

I have a linearlayout that i set a background to a 9-patch drawable. It appears that the linearlayout is somehow forcing its contents to display within the center space defined by its background. This is really creating problems as the content is being "scrunched" or compressed to a much smaller space that what i anticipated. I donot have any margins or padding set on the linearlayout so i know the only place it could be getting this is from the background. All i wanted was for the background to be a background and not some how contribute to how the linearlayout laid out its views. Is there a way to tell the linearlayout not to pull sizing information from its background?I see that the class ninepatchdrawable has a getpadding() but no setpadding(). I assume that the linearlayout is getting the padding from ninepatchdrawable and using that to contrain the contents of the layout to a smaller area. Can i override this without subclassing this class?

Posted On: Feb 6 . View Related Posts . . View 9 Replies .

Can I Have A Paid App Where Content Expires After 1 Year

I would like to create an application where the user pays for the application and then they have access to the content associated with the application for one year. Kind of like a 1 year subscription. Is this allowed with android market? Once the user downloads the content, they can keep it forever, i am mostly concerned with how long do i have to keep the content that the application downloads and uses accessible.

Posted On: Apr 26 . View Related Posts . . View 2 Replies .

How To Make Canvas Translucent Background To Play Images In Activity

How can we make canvas translucent background to play images in the activity.

Posted On: Aug 3 2009 . View Related Posts . . View 2 Replies .

Unable To Display Complete Bitmap In Droid Using Canvas / Get Full To Show

I am using following ondraw method to display bitmap on screen.code.

Image is displayed on the screen but some part because android screen is small
How can i display complete image in whole android screen?

Can i set scaletype of image to fitxy in canvas ?

Or

Can i add android layout image to this canvas so that i could set fitxy property or image there as i have commented the code?


Posted On: Jun 10 at 9:47 . View Related Posts . . View 2 Replies .

Bring Up Local Content On Droid Web Browser

Is there a way to bring up local content (file://xxx.html) on web browsers. I found that we cant from an earlier post due to security reasons.

See in this link: http://www.Mail-archive.com/android-developers@googlegroups.com/msg05.

I need to do this get some browser performance. I am pretty new to web kit and web browser stuff.


Posted On: Feb 11 2009 . View Related Posts . . View 2 Replies .

Htc Droid Eris - Illegal Content In Market / What To Do

So if you download something from the market, and later find out it's most likely illegal, can you get in trouble for downloading it in the first place? I would think there has to be something in place to protect us.

Posted On: 08-18-2010, 01:26 PM . View Related Posts . . View 28 Replies .