user1105975
user1105975

Reputation: 121

how to add uiview to cocos2d android

hi am doing one application here I have to display some editexts and buttons....so some functions through cocos2d not feasible so I want integrate my android code to cocos2d code.I searched net in iphone its possible using addsubview() but android I don't have any idea pls any one can save me... thanks

     in iphone using below code they added subview:
   UIView *myview=[[UIView alloc] initWithFrame: CGRectMake(0, 0,320,480)];
            myview.backgroundColor=[UIColor redColor];
            [[[CCDirector sharedDirector] openGLView] addSubview:myview];
            [myview release];                   

Upvotes: 1

Views: 421

Answers (1)

Karan Rana
Karan Rana

Reputation: 638

You can add view in cocos2d game activity as

        TextView txv=new TextView(GameActivity.context);
        txv.setText("ABC");
        LayoutParams layoutParams =new LayoutParams();
        CCDirector.sharedDirector().getActivity().addContentView(txv,layoutParams);

Upvotes: 1

Related Questions