public class AllOrderSearchDialog extends Dialog {
private Context context;
private RelativeLayout allOrderSearchLeft;
private EditText allOderSearchMiddle;
private TextView allOderSeacrchRight;
private String Title;
public AllOrderSearchDialog(Context context, Handler myHandler, String title) {
/* 设计Dialog样式 */
super(context, R.style.MyDialog);
this.myHandler = myHandler;
this.context = context;
this.title = title;
setContentView(R.layout.all_order_dialog_view);
/* 点击灰色区域让他取消浮层 */
setCanceledOnTouchOutside(true);
/* 关闭对话框取消 */
setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
// 更新AllOrdersActivity布局
new LooperThread().start();
}
});
// 设置布局显示位置、宽度、透明度、是否浮层
LayoutParams layoutParams = getWindow().getAttributes();
layoutParams.gravity = Gravity.TOP;
layoutParams.width = YiWangApp.getInstance().getWindowWidth();
layoutParams.alpha = 1.0f;
getWindow().setAttributes(layoutParams);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
initSearchDialog();
}
private void initSearchDialog() {
allOderSearchMiddle = (EditText) findViewById(R.id.all_oder_search_middle);
allOderSearchMiddle.setText(title);
allOderSearchMiddle.setSelection(allOderSearchMiddle.getText().length());
allOderSeacrchRight = (TextView) findViewById(R.id.all_oder_search_right);
getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
| WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
allOderSeacrchRight.setOnClickListener(new SearchViewOnClickListener());
}
}web