I am showing a progress bar while switching from one screen to another. It is the circular progress bar and there is a message in it "Loading" This message is appearing on the right side of progress bar. I want to show it below the circular loading. Is it possible?
progressDialog = ProgressDialog.show(test2.this, "", "Initializing", false);
Thread thread=new Thread(new Runnable(){
public void run(){
startActivity(new Intent(test2.this, test.class));
runOnUiThread(new Runnable(){
public void run() {
if(progressDialog.isShowing())
progressDialog.dismiss();
}});
}});
thread.start();
For that you have to create a custom dialog box something like below modify it to suit your needs
public static void showProgressDialog(Context mContext, String text, boolean remove)
{
mDialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
LayoutInflater mInflater = LayoutInflater.from(mContext);
View layout = mInflater.inflate(R.layout.popup_example, null);
mDialog.setContentView(layout);
TextView mTextView = (TextView) layout.findViewById(R.id.text);
if (text.equals(""))
mTextView.setVisibility(View.GONE);
else
mTextView.setText(text);
mDialog.setCancelable(remove);
// aiImage.post(new Starter(activityIndicator));
mDialog.show();
}
popup_example.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true">
<ProgressBar
android:id="@android:id/progress"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dip"></ProgressBar>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Loading Content"
android:layout_margin="10dip"
android:textColor="#FFFFFF"
android:layout_gravity="center_vertical" />
</LinearLayout>
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With