我试图在 OnPreExecute 方法中将右重力设置为线性布局,但对话框仍然在左侧显示我的希伯来文文本。我的代码有什么问题?
private ProgressDialog dialog;
private Context context;
private LinearLayout layout;
public MyTask(Activity activity) {
context = activity;
dialog = new ProgressDialog(context);
layout = new LinearLayout(context);
}
protected void onPreExecute() {
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(-1, -2);
layout.setGravity(Gravity.RIGHT);
TextView loadMsg = new TextView(context);
loadMsg.setText("טוען...");
loadMsg.setGravity(Gravity.RIGHT);
layout.addView(loadMsg, params);
dialog.setView(layout);
// dialog.setContentView(R.layout.loaddialog);
// dialog.show();
}