一丶AlertDialog 简单使用
//---------------底部弹出框的View--------------------
private AlertDialog dialog;
private View view;
private TextView tv_commit_text,tv_commit_pic,tv_commit_video;
//-----------------初始化------------------------
private void initAlertDialog(){
dialog=new AlertDialog.Builder(MainActivity.this).create();
dialog.show();
//加载自定义的布局 dialog.getWindow().setContentView(R.layout.pop_hidden);
view=LayoutInflater.from(MainActivity.this).inflate(R.layout.pop_hidden,null);
tv_commit_text= (TextView) view.findViewById(R.id.tv_commit_text);
tv_commit_pic= (TextView) view.findViewById(R.id.tv_commit_pic);
tv_commit_video= (TextView) view.findViewById(R.id.tv_commit_video);
}
二、键盘弹出时 不会挡住输入框
android:windowSoftInputMode=”stateVisible|adjustResize”
//强制关闭输入键盘
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput( InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
//PopWindow的用法
private PopupWindow pop_modify;
private RelativeLayout mRl_txtimage_modify, mRl_video_modify;
private void initPopuWindow() {
View view = LayoutInflater.from(getActivity()).inflate(R.layout.pop_mofidy, null);
mRl_txtimage_modify = (RelativeLayout) view.findViewById(R.id.rl_txtimage_modify);
mRl_video_modify = (RelativeLayout) view.findViewById(R.id.rl_video_modify);
pop_modify = new PopupWindow(view, 500, 200, true);
pop_modify.setFocusable(true);//可以被选中
pop_modify.setTouchable(true);//触摸可用
pop_modify.setOutsideTouchable(true);//点击控件外部消失
pop_modify.setBackgroundDrawable(new BitmapDrawable(getResources(), (Bitmap) null));
pop_modify.setOutsideTouchable(true);
pop_modify.showAtLocation(getActivity().findViewById(R.id.ll_modify_bottom), Gravity.CENTER, 0, 0);
mRl_video_modify.setOnClickListener(this);//视频整改
}