要禁用标题栏,请尝试在清单中添加 -
android:theme="@android:style/Theme.NoTitleBar"
或试试这个:
在样式中添加这个 -
<style name="Theme.Transparent" parent="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">"
<item name="android:windowBackground">#000000</item>
</style>
然后在 Manifest 中将主题设置为 -
android:theme="@style/Theme.Transparent"
据我所知,requestWindowFeature(Window.FEATURE_NO_TITLE);
应该可以正常工作。像这样尝试添加一次setContentView(...)
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(com.android.internal.R.layout.preference_list_content);
...
}
我不确定,但由于默认边距,您的 WebView 可能会留下空间。您的布局文件必须有点像这样 -
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
//REMOVE THIS CODE
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
//TILL HERE
tools:context="com.example.web.MainActivity" >
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent" //MAKE THIS MATCH_PARENT
android:layout_height="match_parent" //MAKE THIS MATCH_PARENT
android:layout_alignParentBottom="true" />
...
</RelativeLayout>
删除这个 -
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
还要确保你没有任何其他边距和填充,并确保 WebView 的高度和宽度是match_parent
......