如何删除我的Android应用程序底部的灰色栏?

时间:2015-12-24 06:31:24

标签: android

出于某种原因,我的应用程序底部有一个灰色栏:

my app 我似乎无法摆脱它。

这是我的活动xml:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    tools:context="be.valuya.comptaplan.mobile.ComptaPlanMobileActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme">

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_compta_plan_mobile" />

</android.support.design.widget.CoordinatorLayout>

这是布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_weight="1"
    android:layout_width="fill_parent"
    android:layout_height="fill_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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="be.valuya.comptaplan.mobile.ComptaPlanMobileActivity"
    tools:showIn="@layout/activity_compta_plan_mobile">

    <WebView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/webView"
        android:layout_gravity="start"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentEnd="true"
        android:layout_alignParentBottom="true" />
</RelativeLayout>

styles.xml:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

5 个答案:

答案 0 :(得分:6)

简单。实际上@dimen值在这里起着至关重要的作用。

android:paddingBottom="@dimen/activity_vertical_margin"

您可以在此处activity_vertical_margin设置值“0dp”,或者只需删除此行。

CoordinatorLayout :将身高和宽度设置为fill_parent

答案 1 :(得分:1)

dimens.xml 中将其指定为0dp,或从布局中删除这些属性。或平均调整所有填充。

  android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"

答案 2 :(得分:1)

尝试将布局xml中android:paddingBottom的值替换为0dp

答案 3 :(得分:1)

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="be.valuya.comptaplan.mobile.ComptaPlanMobileActivity"
    tools:showIn="@layout/activity_compta_plan_mobile">

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

答案 4 :(得分:0)

为什么你的布局需要重量?  我做了一些改变尝试

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"

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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="be.valuya.comptaplan.mobile.ComptaPlanMobileActivity"
tools:showIn="@layout/activity_compta_plan_mobile">

<WebView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/webView"
    android:layout_gravity="start"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_alignParentBottom="true" />
    </RelativeLayout>

并放入dimen文件夹

 <dimen name="activity_vertical_margin">0dp</dimen>
 <dimen name="activity_horizontal_margin">0dp</dimen>

你的activity.xml必须像这样

    <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"

    <android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:theme="@style/AppTheme">

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_compta_plan_mobile" />