c# - Xamarin.Android : Gravity parameter in DrawerLayout.LayoutParams -


i'm trying create drawerlayout programmatically using xamarin.android, faced problem when trying add listview should dragable form left ..

here code :

drawerlayout mydrawerlayout = new drawerlayout(this); mydrawerlayout.layoutparameters = new linearlayout.layoutparams(viewgroup.layoutparams.matchparent, viewgroup.layoutparams.matchparent); setcontentview(mydrawerlayout);   framelayout myframelayout = new framelayout(this); myframelayout.layoutparameters = new drawerlayout.layoutparams(viewgroup.layoutparams.matchparent, viewgroup.layoutparams.matchparent); myframelayout.setbackgroundcolor(android.graphics.color.gray); mydrawerlayout.addview(myframelayout);   listview mylistview = new listview(this); mylistview.setbackgroundcolor(android.graphics.color.green); mylistview.layoutparameters = new drawerlayout.layoutparams( width: 240,                                                   height: drawerlayout.layoutparams.matchparent,                                                   gravity: ????????                                                            ); mydrawerlayout.addview(mylistview); 

as can notice.. didn't know pass gravity parameter

the definition of function in drawerlayout class :

public layoutparams(int width, int height, int gravity); 

so have pass int gravity, how ??

i've tried following :

mylistview.layoutparameters = new drawerlayout.layoutparams( width: 240, height: drawerlayout.layoutparams.matchparent, gravity: gravity.left); 

it gives me error:

'gravity' not contain definition 'left'

also tried :

mylistview.layoutparameters = new drawerlayout.layoutparams( width: 240, height: drawerlayout.layoutparams.matchparent, gravity: gravityflags.left); 

but gives me error:

cannot convert 'android.views.gravityflags' 'int'

hope have idea solution .. , in advance

you have cast flag int like

new drawerlayout.layoutparams(240, drawerlayout.layoutparams.wrapcontent, (int)(gravityflags.start | gravityflags.left)). 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -