2014-03-04 33 views
0

薩拉姆Android的進度條調用setVisible不工作

我有問題的的AsyncTask

塞汀進度的知名度一些細節

一些細節

一些細節

一些更多細節

個一些細節

這是我的代碼:

public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> { 

ImageView IV; 
FullImageActivity MA; 
ProgressBar lp1; 

public DownloadImageTask(ImageView IV, 
     FullImageActivity fullImageActivity) { 
    this.IV = IV; 
    this.MA = fullImageActivity; 
    lp1 = (ProgressBar) MA.findViewById(R.id.progressBar1); 
} 

protected Bitmap doInBackground(String... p) { 
    String url = "..."; 
    Bitmap BI = null; 
    try { 
     InputStream in = new java.net.URL(url).openStream(); 
     BI = BitmapFactory.decodeStream(in); 
    } catch (Exception e) { 
     Log.e("Error", e.getMessage()); 
     e.printStackTrace(); 
    } 
    return BI; 
} 

@Override 
protected void onPreExecute() { 
    lp1.setVisibility(1); 
    super.onPreExecute(); 
} 

protected void onPostExecute(Bitmap result) { 
    IV.setImageBitmap(result); 
    lp1.setVisibility(0); 
} 
} 

和我的XML

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/RelativeLayout1" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" > 

<ImageView 
    android:id="@+id/full_image_view" 
    android:layout_width="fill_parent" 
    android:layout_height="match_parent" /> 

<ProgressBar 
    android:id="@+id/progressBar1" 
    style="?android:attr/progressBarStyleLarge" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true" /> 

</RelativeLayout> 

當我使用

lp1.setVisibility(0); 

lp1.setVisibility(ProgressBar.GONE); 

lp1.setVisibility(View.GONE); 

lp1.setVisibility(View.INVISIBLE); 

我的進度仍然可見

+1

爲什麼你用進度條使用'Progress Dialog'而不是'onPostExecute(.....)' –

+0

tanx @SimplePlan我使用 – Hamidreza

回答

0
lp1.setVisibility(0); 

0View.VISIBILE

Here的文檔

+0

tanx @blackbelt,但仍然不工作 – Hamidreza