Cocos2d-x how to solve the CCEditBox In the Android platform does not respond to touch Problems

Source: Internet
Author: User

Use the following code to add CCEditBox to the class as an input box. The Code is as follows:

// Add input default anchor (0.5, 0.5). modification is useless. Then, the coordinates cannot be layer-based // coordinates. The screen-based coordinates m_tf_input = CCEditBox must be used :: create (CCSizeMake (280*0.5, 60*0.5), CCScale9Sprite: create ("variables"); m_tf_input-> setFontColor (ccWHITE); m_tf_input-> setPlaceHolder (receivagemanager :: sharedreceivagemanager ()-> getLocalizedString ("Click here and input "). c_str (); m_tf_input-> setText (""); m_tf_input-> setMaxLength (MAX_CHAT_MSG_LENGTH); m_tf_input-> setReturnType (parameters); m_tf_input-> setDelegate (this ); this-> addChild (m_tf_input); m_tf_input-> setPosition (ccp (m_originPoint.x + this-> getPosition (). x + m_size.width * 0.5-130 * 0.5f, m_originPoint.y + this-> getPosition (). y + m_size.height * 0.5-184 * 0.5f ));

There is no problem with inputting on the IOS platform, but the input cannot be accepted on the Android platform. Later I found that setting the touch priority is OK.

CCEditBox is inherited from CCControlButton, and then

CCControlButton inherits from CCControl, and then

CCControl has a function.

M_tf_input-> setdefatoutouchpriority (-128.

Because its default priority is 1, the priority below Android is not enough.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.