1
アクティビティでダイアログを表示しています。
私はこのコードAlertDialog:一部のデバイスで背景色が透明でない
dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
、ダイアログ背景を透明に示しを用いて透明に背景色を設定し、私はいくつかの他のデバイス上で自分のアプリケーションをテストする際に問題が発生します。
透明ではなく白い背景が表示されます。
異なるデバイスで同じコードを使用することによってどのように問題が発生するのかわかりません。ここで
は私のコードは
あるfinal AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this);
LayoutInflater inflater = this.getLayoutInflater();
View dialogView = inflater.inflate(R.layout.update_client, null);
****** some code*******
dialogBuilder.setView(dialogView);
alertDialog = dialogBuilder.create();
alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
// alertDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0));
alertDialog.setCanceledOnTouchOutside(false);
alertDialog.show();
}
この 'dialog.getWindow()。setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));'を使用してください。 –
私はすでに試してみましたが、動作していません –