0
如果我在我的應用程序中按下後退按鈕,它將顯示一個白色屏幕。如果我再次按它,它會顯示我的活動。我如何刪除白屏活動?如何避免在Android上按下後退按鈕時在web視圖中出現白屏?
這是我的活動:
public class Facebook extends AppCompatActivity
{
WebView fb_link;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_facebook);
fb_link = (WebView) findViewById(R.id.fb);
fb_link.getSettings().setJavaScriptEnabled(true);
fb_link.loadUrl("https://www.facebook.com/profile.php id=100012806950302");
fb_link.getSettings().setLoadsImagesAutomatically(true);
fb_link.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
fb_link.getSettings().getBuiltInZoomControls();
fb_link.getSettings().setPluginState(WebSettings.PluginState.ON);
fb_link.setInitialScale(1);
fb_link.getSettings().setLoadWithOverviewMode(true);
fb_link.getSettings().setUseWideViewPort(true);
fb_link.setScrollbarFadingEnabled(false);
fb_link.getSettings().setAllowFileAccess(true);
fb_link.setWebChromeClient(new WebChromeClient());
}
public void onBackPressed()
{
if(fb_link!=null && fb_link.canGoBack())
fb_link.goBack();// if there is previous page open it
else
super.onBackPressed();//if there is no previous page, close app
}
}
如果我按後退按鈕第一次會顯示白色屏幕...我再次按下按鈕我以前的活動將打開...如何避免白色屏幕? –