1

In this code piece i've built a dialog, a textView and put the textView inside the Dialog.

TextView progressHolder = new TextView(activity);
progressHolder.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
progressHolder.setText("la la la3");
progressHolder.setBackgroundColor(Color.TRANSPARENT);

mProgressDialog = new Dialog(activity);
mProgressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(R.color.transparent));
mProgressDialog.setContentView(progressHolder);
mProgressDialog.show();

Displaying this dialog is supposed to show the words "la la la3" on screen with the activity showing behind them.

What actually happens is that most of the activity is revealed but the words described appear in a small black box that only wraps around the words width but has a big top margin.

For question sake, i'm not trying to show a textView but the bug still happens with this exact code.

Help anyone?

4

3 回答 3

0

试试这个代码..

yourDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
于 2014-03-13T10:39:00.257 回答
0

这个:

    mProgressDialog.getWindow().setBackgroundDrawable(new BitmapDrawable());
于 2013-10-21T11:27:13.087 回答
0

要删除黑色背景颜色,请使用

getWindow().setBackgroundDrawableResource(android.R.color.transparent);
于 2014-07-30T06:48:17.553 回答