可能重复: Android web视图 - 网页应符合设备屏幕
我要呈现在Android的WebView功能的网页。现在,我可以显示一个网页,但如何让屏幕在它适合? 我提到: 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>
瑞安