2017-05-02 13 views
1

プログレスバー(5又はheigher)...すべてのデバイスに表示されないプログレスバーが

<ProgressBar 
     android:id="@+id/progressBarMain" 
     style="?android:attr/progressBarStyle" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     tools:layout_editor_absoluteY="16dp" 
     android:layout_marginRight="8dp" 
     app:layout_constraintRight_toRightOf="parent" 
     android:layout_marginLeft="8dp" 
     app:layout_constraintLeft_toLeftOf="parent" 
     android:indeterminate="true" 
     /> 

Allotment.java

public class Allotment extends AppCompatActivity { 

    WebView webViewCir; 
    ProgressBar bar; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_allotment); 
     Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
     setSupportActionBar(toolbar); 

     FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); 
     fab.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View view) { 
       Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) 
         .setAction("Action", null).show(); 
      } 
     }); 
     getSupportActionBar().setDisplayHomeAsUpEnabled(true); 

     final WebView webViewCir = (WebView) findViewById(R.id.webViewAllot); 
     webViewCir.setWebViewClient(new mywebclint()); 
     webViewCir.getSettings().setJavaScriptEnabled(true); 
     webViewCir.loadUrl("http://www.rwdbihar.in/article_allotments_d.aspx?config_id=8"); 

     fab.setOnClickListener(new View.OnClickListener() { 
      public void onClick(View v) { 
       // webview.setWebViewClient(new WebViewClient()); 
       webViewCir.loadUrl("http://www.rwdbihar.in/article_allotments_d.aspx?config_id=8"); 
      }}); 

     bar=(ProgressBar) findViewById(R.id.progressBarAllot); 



    } 



    public class mywebclint extends WebViewClient{ 
      @Override 
      public void onPageFinished(WebView view, String url) { 
       super.onPageFinished(view, url); 
       bar.setVisibility(View.GONE); 
      } 

      @Override 
      public void onPageStarted(WebView view, String url, Bitmap favicon) { 
       super.onPageStarted(view, url, favicon); 
      } 
     enter code here 
      @Override 
      public boolean shouldOverrideUrlLoading(WebView view, String url) { 
       view.loadUrl(url); 
       return super.shouldOverrideUrlLoading(view, url);`enter code here` 
      } 
     } 
+0

私はwebViewを持っています.....すべての活動と進行状況バーに配置されて..... –

答えて

0

..コードの下にこれを試し

private class MyBrowser extends WebViewClient { 
      @Override 
      public boolean shouldOverrideUrlLoading(WebView view, String url) { 
       view.loadUrl(url); 
       return true; 
      } 

      @Override 
      public void onPageStarted(WebView view, String url, Bitmap favicon) { 
       super.onPageStarted(view, url, favicon); 
       progressDialog_webview = new ProgressDialog(Yourclassname.this); 
       progressDialog_webview.setMessage("Please wait ..."); 
       progressDialog_webview.show(); 
      } 

      @Override 
      public void onPageFinished(WebView view, String url) { 
       super.onPageFinished(view, url); 
       if (progressDialog_webview != null) { 
        progressDialog_webview.dismiss(); 
       } 
      } 

     } 
+0

私の解決策があなたのために役立つリレーであれば私にupvoteを与えてください。 –