I have a ProgressBar and a login button. When i click on the login button i show this progressBar and everything worke fine. But it would be nice if i have a black transparent layer, like the AlertDialog class it do, and only the progressBar has the full bright.
Asked
Active
Viewed 3,386 times
2 Answers
2
Try to create another class with transculent theme. For example new class:
public class BlahActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_blah);
ProgressDialog pg = new ProgressDialog(this);
pg.setTitle("Title of progress dialog");
pg.setMessage("Message of progress dialog");
pg.show();
}
}
And change in AndroidManifest.xml file (check second line):
<activity
android:name="com.example.dialog.BlahActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/title_activity_blah" >
</activity>
Now, when you click on button in your class, you will have to only create new intent to open transculent class. OnCreate it will run ProgressDialog which will blur the rest and you will be able see text from the last activity.
You can also try with opening new intents with options onResult, this will allow you open intent - do something - and back to the last activity.
If you want total black, you don't have to set theme as transculent, just set background to black.

deadfish
- 11,996
- 12
- 87
- 136
0
You can set in xml of the layout android:background:#60000000 where two first numbers are alpha and 6 next are the color in hex.

ƒernando Valle
- 3,634
- 6
- 36
- 58
-
but its not a solution for my problem. i want a transparent black layer while the progressBar is visible like 5 seconds. – Dennis Dec 08 '12 at 23:32
-
set a layout with this background, set the progressBar in it and show it when you press the button. I dont know if that is what you want. But I understand it. – ƒernando Valle Dec 08 '12 at 23:35
-
ok ill try it but it will be full black not transparent. but how is the solution in the alertdialog class. i watched the class but i didnt get it. – Dennis Dec 08 '12 at 23:37
-
you can take a look here: http://stackoverflow.com/questions/2422562/how-to-change-theme-for-alertdialog the second reply I think is more or less that you want – ƒernando Valle Dec 08 '12 at 23:40