Reputation: 1719
In my android application I am using progress dialog in my splashscreen. I would like to see only the progressbar with loading message without the background. Is there any way that I can change the background to transparent in Android?
Please share your valuable suggestions.
Upvotes: 5
Views: 10989
Reputation: 17401
Create a dialog set set the dialog style to following:
<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowNoTitle">true</item>
</style>
For ex:
Dialog dialog = new Dialog(main.this,R.style.CustomDialogTheme);
dialog.setContentView(<layout>);
Just put your progress bar in layout.
Upvotes: 0
Reputation: 1977
make layout .xml file which you want to display in Dialog then Create Object of Dialog
Dialog dialog = new Dialog(main.this);
Upvotes: 0
Reputation: 309
ProgressBar should be placed on the Layout and then you have to set or change the progressbar in your activity.
Beware of setting the background before setting max, min, progress and text or it will not render correctly.
Upvotes: 1
Reputation: 11571
You can do this with the help of custom dialog instead of using progress dialog. Custom dialog will be a better approach to do this . Follow the link. You can also use
android:background="@android:color/transparent"
in the background property of the parent layout in order to make it transparent.
Hope this will solve your problem
Upvotes: 0
Reputation: 91175
As MGS says, you can put the <Progressbar>
in your layout xml file itself. Moreover you want to customize your ProgressDialog then you have to study the CustomDialog Tutorial in the Documentation. It explains everything about Dialog completely.
Upvotes: 0
Reputation: 3313
you can get it by defining the progressbar and the text in your xml file and you control it in your activity.
Upvotes: 0