【问题标题】:Android - Webview Cuts Off on Smaller ScreenAndroid - Webview 在较小的屏幕上被切断
【发布时间】:2012-12-10 03:55:21
【问题描述】:

我有一个 Google 日历,我正试图在我的 Android 应用程序中显示,但是当我这样做时,它在我的 HTC Incredible 2 上被切断了。它在我的 Nexus 7 上显示正常。我尝试过使用找到答案here 但仍然没有运气。任何帮助都会很棒。谢谢!

  public class Events extends SherlockActivity
  {
    boolean isLoaded = false;
ActionBar actionBar;
WebView eventView;
ProgressDialog progressDialog;

@Override
protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.events);

    actionBar = getSupportActionBar();

    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);

    eventView = (WebView) findViewById(R.id.eventsView);
    eventView.getSettings().setJavaScriptEnabled(true);


    final Activity activity = this;

    /* Cut out loading screen, etc */

    eventView.loadUrl("https://www.google.com/calendar/embed?showTitle=0&mode=MONTH&height=600&wkst=1&bgcolor=%23ffffff&src=fresnochaffeezoo%40gmail.com&color=%23182C57&ctz=America%2FLos_Angeles");

}



<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

 <WebView
    android:id="@+id/eventsView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />

  </RelativeLayout>

【问题讨论】:

    标签: android xml webview


    【解决方案1】:

    以下设置有助于页面最初呈现的方式:

    eventView.getSettings().setUseWideViewPort( false );
    eventView.getSettings().setLoadWithOverviewMode( true );
    

    可选:

    eventView.getSettings().setDefaultZoom( ZoomLevel. ... );
    

    【讨论】:

      猜你喜欢
      • 2021-07-13
      • 1970-01-01
      • 2017-02-16
      • 2023-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-17
      • 1970-01-01
      相关资源
      最近更新 更多