tabbar goes up along with keyboard

拈花ヽ惹草 提交于 2019-12-10 18:26:23

问题


This has been posted before but no answers.

Problem:

TabBar --> (2 tabs)

  • tab one has a Scrollview and an EddiText
  • 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!