I found a way to avoid the problem, but just avoiding it, I still want to know the solution in Android 2.3.
I used to build controls in XML above and below, like this:
<ToolBar android:id="@+id/blabla" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" />
So, when the keyboard is displayed, the activity window changes, so the ToolBar is pressed, which does not look very good.
Now I am arranging the controls on top, it is still resizing through the window, but the ToolBar and other controls will not be pressed, they just exit the window when the soft keyboard is displayed.
source share