Skip to content Skip to sidebar Skip to footer

Progressbar Dialog Without Border

I am displaying a ProgressBar in Android, as seen below: but there is a white border around the progress bar. What if I dont want to display any border? i.e., only the progress ba

Solution 1:

After some experiments I got to the following:

<?xml version="1.0" encoding="utf-8"?><resources><stylename="my_style"parent="@android:style/Theme.Dialog" ><itemname="android:windowBackground">@null</item></style></resources>

If I use this theme as a style for an Activity I get no frame. If you use this with the Dialog constructor: Dialog(context, theme) you get no frame.

Solution 2:

do you still need ideas for this? I implemented the same thing in my app, but not as a dialog, I had two layouts that overlap each other. I then flip between the two layouts by setting the visibility .setVisibility(). As for the actual progress bar itself, I use this:

EDIT: Here's my whole XML file:

<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent"android:background="@drawable/background"><RelativeLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/search_header"android:background="@drawable/header"><!-- Some things I need for the header (title, etc) --></RelativeLayout><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/spinner_layout"android:layout_below="@+id/search_header"android:layout_centerHorizontal="true"android:layout_centerVertical="true"><ProgressBarandroid:id="@+id/title_progress_bar"style="?android:attr/progressBarStyleSmallTitle"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_centerVertical="true"android:visibility="visible"android:indeterminateOnly="true"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:id="@+id/loading_label"android:text="Loading..."android:layout_gravity="center_vertical"android:layout_marginLeft="5dip"></TextView></LinearLayout><RelativeLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/search_header"android:id="@+id/list_contents"><!-- Stuff you want to show after returning from the AsyncTask --></RelativeLayout></RelativeLayout>

I use this layout for an Activity with an AsyncTask, so onPreExecute(), I do something like:

@Override
protected void onPreExecute(){
 findViewById(R.id.list_contents).setVisibility(View.GONE);
 findViewById(R.id.spinner_layout).setVisibility(View.VISIBLE);
}

And then do whatever I have to do, and onPostExecute() I have:

@Override
protected void onPostExecute(Cursor cursor){
 findViewById(R.id.list_contents).setVisibility(View.VISIBLE);
 findViewById(R.id.spinner_layout).setVisibility(View.GONE);
}

Post a Comment for "Progressbar Dialog Without Border"