如何使用android studio将iframe添加到活动中(我想从网站添加google日历)

时间:2016-04-02 18:02:39

标签: java android xml android-studio

这是我的iframe代码:

<iframe src="https://www.google.com/calendar/embed?mode=WEEK&amp;height=600&amp;wkst=7&amp;bgcolor=%23FFFFFF&amp;src=diit.info_m7f27lakenu0t49fbe2aojn9rg@group.calendar.google.com&amp;color=%23865A5A&amp;ctz=Asia%2FDhaka" style=" border-width:0 " width="750" height="440" frameborder="0" scrolling="no"></iframe>`

现在我想在我的活动中显示这个谷歌日历。请让我知道我该怎么做。

2 个答案:

答案 0 :(得分:0)

使用WebVew我猜......? 或者您遇到任何使用它的问题?

答案 1 :(得分:0)

如果你想在你的应用中显示谷歌日历。你必须使用谷歌日历API。 以下是谷歌开发人员的逐步教育。

google calendar app

如果您想在应用中显示网站,可以使用WebView。

enter code public class WebViewActivity extends AppCompatActivity {
private WebView mWebView;
private static final String urlTag = "url";

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    Intent intent = getIntent();
    String postUrl = intent.getStringExtra(urlTag);
    String title=intent.getStringExtra("title");
    mWebView = new WebView(this);
    mWebView.getSettings().setJavaScriptEnabled(true);

    final Activity activity = this;

    mWebView.setWebViewClient(new WebViewClient() {
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Toast.makeText(activity, description, Toast.LENGTH_SHORT).show();
        }
    });

    mWebView.loadUrl(postUrl);
    // setContentView(mWebView);

    // TODO:YUKLEME PROGRESS DENE
   mWebView.setWebViewClient(new WebViewClient() {
        ProgressDialog progressDialog = new ProgressDialog(WebViewActivity.this);

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            Log.e("I am  loading Here ", "Start");
            progressDialog.setTitle("Loading");
            progressDialog.setMessage("Please wait....");
            progressDialog.show();

        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Log.e("I am  loading Here ", "Override");
            view.loadUrl(url);
            return true;

        }

        @Override
        public void onPageFinished(WebView view, String url) {
            progressDialog.dismiss();
        }

    });
    setContentView(mWebView);
}