Android Webview不能占满整个activity解决办法

来源:互联网 发布:任意号码显示软件 编辑:程序博客网 时间:2024/05/19 00:40

作为一个初学者,这个问题很不好解决,所以记下来,留给后来人,我原来布局是这样的

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/activity_main"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:paddingBottom="@dimen/activity_vertical_margin"    android:paddingLeft="@dimen/activity_horizontal_margin"    android:paddingRight="@dimen/activity_horizontal_margin"    android:paddingTop="@dimen/activity_vertical_margin"    tools:context="com.future.browser.MainActivity">   <WebView       android:layout_width="match_parent"       android:layout_height="match_parent"       android:id="@+id/wb" /></RelativeLayout>
结果发现浏览器不能铺满整个屏幕,也就是整个activity,后来发现把布局删除,只用以下布局就可以了
<WebView  xmlns:android="http://schemas.android.com/apk/res/android"    android:id="@+id/wb"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    />
Android Studio 2.2.2测试通过,大家可以试一下

原创粉丝点击