mirror of https://github.com/axmolengine/axmol.git
[android] move the TextField position to visable while soft keyboard popup
This commit is contained in:
parent
1340bbf842
commit
4da5a0eb71
|
@ -278,7 +278,13 @@ void TextFieldTTFDefaultTest::onEnter()
|
||||||
FONT_SIZE);
|
FONT_SIZE);
|
||||||
addChild(pTextField);
|
addChild(pTextField);
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
// on android, CCTextFieldTTF cannot auto adjust its position when soft-keyboard pop up
|
||||||
|
// so we had to set a higher position to make it visable
|
||||||
|
pTextField->setPosition(ccp(s.width / 2, s.height/2 + 50));
|
||||||
|
#else
|
||||||
pTextField->setPosition(ccp(s.width / 2, s.height / 2));
|
pTextField->setPosition(ccp(s.width / 2, s.height / 2));
|
||||||
|
#endif
|
||||||
|
|
||||||
m_pTrackNode = pTextField;
|
m_pTrackNode = pTextField;
|
||||||
}
|
}
|
||||||
|
@ -333,7 +339,14 @@ void TextFieldTTFActionTest::onEnter()
|
||||||
addChild(m_pTextField);
|
addChild(m_pTextField);
|
||||||
|
|
||||||
m_pTextField->setDelegate(this);
|
m_pTextField->setDelegate(this);
|
||||||
|
|
||||||
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||||
|
// on android, CCTextFieldTTF cannot auto adjust its position when soft-keyboard pop up
|
||||||
|
// so we had to set a higher position
|
||||||
|
m_pTextField->setPosition(ccp(s.width / 2, s.height/2 + 50));
|
||||||
|
#else
|
||||||
m_pTextField->setPosition(ccp(s.width / 2, s.height / 2));
|
m_pTextField->setPosition(ccp(s.width / 2, s.height / 2));
|
||||||
|
#endif
|
||||||
|
|
||||||
m_pTrackNode = m_pTextField;
|
m_pTrackNode = m_pTextField;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue