爲博客閱讀器應用程序,應用程序工作時,當我嘗試查看作爲webview的活動內的樹屋博客網站。但是,當我嘗試iTunes網址或其他網站時,它不會顯示我的活動內容,而是會打開Chrome。現在我不知道這是否正常,或者我必須爲此添加一些代碼,謝謝。下面是我實現的web視圖的活動代碼,感謝android中的webview不顯示內容
package com.paveynganpi.applestorefeed;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.WebView;
public class AppleFeedWebViewActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apple_feed_web_view);
//get the intent from MainListActivity.java
Intent intent = getIntent();
Uri appleFeedUri = intent.getData();
WebView webView = (WebView)findViewById(R.id.webView);
webView.loadUrl(appleFeedUri.toString());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_apple_feed_web_view, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
感謝男人,它工作:) – user3137376