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