android - How to dynamically create a SurfaceView with rounded corners -


i'm working on xamarin.android project involves dynamically creating view hierarchies represent controls. 1 such control uses androidgameview class, inherits surfaceview , allows drawing opengl es. i'm trying figure how give view rounded corners. i've tinkered overriding ondraw method or applying drawable background clip, haven't had success. this question seems similar goal, not figure out how dynamically instead of using axml. possible dynamically give surfaceview rounded corners?

there no direct support on android.

i think best approach create rounded rectangle shape want large triangle fan defines rounded corners , position behind scene , make opaque. format surfaceview must bitmap.config.argb_8888 , use setopaque(0) , setalpha(1.0). glclearcolor() must transparent black blend android canvas:

glclearcolor(0.0f, 0.0f, 0.0f, 0.0f); glclear(gl_depth_buffer_bit | gl_color_buffer_bit); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -