Finally, I will find a workaround for my problem, so I want to share with someone who might get the same problem in the future. A brief description of my layout:
<myRelativeLayout> <topbar.../> <myscrollView> <linearLayout> //all stuff controls:editview,textview,.... </linearLayout> </myscrollView> <bottombar.../>
i create a custom class myRelativeLayout extend RelativeLayout
public class myRelativeLayout extends RelativeLayout{ public interface OnRelativeLayoutChangeListener { void onLayoutPushUp(); void onLayoutPushDown(); } private OnRelativeLayoutChangeListener layoutChangeListener; public myRelativeLayout(Context context, AttributeSet attrs) { super(context, attrs);
}
And in my activity, I just set setLayoutChangeListener for myRelativeLayout to hide the narrow harvester when the on-screen keyboard appears and displays the "narrow" block when the hidden keyboard is hidden:
myRlayout.setLayoutChangeListener(new OnRelativeLayoutChangeListener() { @Override public void onLayoutPushUp() { // TODO Auto-generated method stub myBottombar.setVisibility(View.GONE);//in my case i need to setVisibility(View.GONE) to bottombar in order for this bar is not displayed when softkeyboard show up. } @Override public void onLayoutPushDown() { // TODO Auto-generated method stub myBottombar.setVisibility(View.VISIBLE);// redisplay myBottombar when keyboard is closed. } });
Remember to set android: windowSoftInputMode = "adjustResize" for activity. Hope this is helpful for someone getting the same issue.
source share