如何适应Android的屏幕(web视图)在网页上? [英] How to fit a webpage on android screen(webview)?

查看:159
本文介绍了如何适应Android的屏幕(web视图)在网页上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  <一href="http://stackoverflow.com/questions/3916330/android-webview-webpage-should-fit-the-device-screen">Android web视图 - 网页应符合设备屏幕

我要呈现在Android的WebView功能的网页。现在,我可以显示一个网页,但如何让屏幕在它适合? 我提到: <一href="http://stackoverflow.com/questions/3916330/android-webview-webpage-should-fit-the-device-screen">Android web视图 - 网页应该适合该设备的屏幕 但并没有找到一个解决方案在那里。

I want to render a webpage in android's webview. Currently, I can display a webpage but how to make it fit within the screen? I referred to: Android Webview - Webpage should fit the device screen but didn't find a solution there.

谢谢!

推荐答案

你的问题不是很清楚,但如果我猜你的意思是的WebView 未扩展到适应整个屏幕?请发表您的code来支持你的问题。

Your question is not very clear but if I'm guessing you mean the webview is not expanding to fit the whole screen? Please post your code to support your question.

为了让的WebView 扩大到整个屏幕,添加的WebView 在你的活动布局的XML,并确保将 layout_width layout_height 来FILL_PARENT。这里有一个简单的例子:

To make the webview expand to the whole screen, add the webview in your activity layout xml and make sure you set the layout_width and layout_height to fill_parent. Here's a simple example:

  <LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">
      <WebView  
          android:id="@+id/webview"
          android:layout_width="fill_parent" 
          android:layout_height="fill_parent"/>
  </LinearLayout>

瑞安

这篇关于如何适应Android的屏幕(web视图)在网页上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆