底部布局用RelativeLayout固定在底部,软键盘弹出上顶
//软键盘弹出顶底板布局解决办法 getWindow().setSoftInputMode (WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN| WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
屏幕的百分比方法
//屏幕比例 DisplayMetrics dm = new DisplayMetrics(); dm = getResources().getDisplayMetrics(); screenWidth = dm.widthPixels; RelativeLayout.LayoutParams layoutParams = (android.widget.RelativeLayout.LayoutParams) rl_shopsearch .getLayoutParams(); layoutParams.width = (int) (screenWidth * 0.8); rl_shopsearch.setLayoutParams(layoutParams);