-1

I need to implement TextView widget in cocos2d-android-1 and don't know how please help

TextView textView = null;

textView.setText(R.string.billing_not_supported_message);
addChild(textView);

This code not working because addChild needs node. Please help really need.

VyacheslavK
  • 39
  • 1
  • 5

1 Answers1

1

I completely agree that the android version of cocos2d needs some serious 'standard UI' features adding to it.

At the moment, your only real option is to take a similar approach to my previous answer here

ANDROID:How to open web page in class extends CCLayer

whereby you have a layout which will put a textview on the screen (or you construct it yourself in your handler), and you use a handler from the activity which your scene is running in to show/hide it.

It's clunky and horrible but it works. In my field designer app i faced the same problem, but i also had to have a custom background to the text field, which resized with the text field, that had a rough edge, and the text view had to fall inside that rough edge so all the text was visible on the main bit of the background.

i achieve that using this same technique, but i created a layout xml file so that i had control over how the textview and it's background were displayed.

(note to show/hide the textview i had to give its root layout a constant ID and check for if that ID existed, and was visible, as when people touched outside it, i needed to make it vanish)

Community
  • 1
  • 1
rspython
  • 229
  • 1
  • 9