问题
This has been posted before but no answers.
Problem:
TabBar --> (2 tabs)
- tab one has a
Scrollviewand anEddiText - tab two: something else
When taping the EditText, the soft keyboard goes up and TabBar along with it.
(An ugly solution would be to disable scrolling in ScrollView)
Any decent solution to this?!
回答1:
A simple solution would be to tell the TabBar to adjust for Softkeyboard Mode. To do this, go to your manifest file, and in the Tabbar Activity add this line,
android:windowSoftInputMode="adjustPan"
This makes your Tabbar to stay at the bottom even when the softkeyboard is visible.
回答2:
Update: Ignore answer, thought you were using Adobe Flex for Android (dont know why!!) This works, hides the tabbar on soft/virtual keyboard being activated, and makes it visible again when its deactivated.
The listeners could be added on a global application level http://bbishop.org/blog/?p=524.
<?xml version="1.0" encoding="utf-8"?>
<fx:Script>
<![CDATA[
import mx.core.FlexGlobals;
protected function textinput1_softKeyboardActivatingHandler(event:SoftKeyboardEvent):void
{
// TODO Auto-generated method stub
FlexGlobals.topLevelApplication.tabbedNavigator.tabBar.visible = false;
}
protected function textinput1_softKeyboardDeactivateHandler(event:SoftKeyboardEvent):void
{
// TODO Auto-generated method stub
FlexGlobals.topLevelApplication.tabbedNavigator.tabBar.visible = true;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Scroller id="scroller" left="10" right="10" top="10" bottom="70" >
<s:VGroup paddingTop="3" paddingLeft="5" paddingRight="5" paddingBottom="3" horizontalAlign="center">
<s:TextInput softKeyboardActivating="textinput1_softKeyboardActivatingHandler(event)"
softKeyboardDeactivate="textinput1_softKeyboardDeactivateHandler(event)"/>
</s:VGroup>
</s:Scroller>
来源:https://stackoverflow.com/questions/6550878/tabbar-goes-up-along-with-keyboard