工具栏视图上方的不可见工具栏

时间:2016-04-27 15:57:57

标签: android android-toolbar

下面的图片说明了一切。

enter image description here

我用于此活动的是:

    <style name="FormActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

我正在我的代码中添加工具栏:

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.toolbar_underling));

    toolbarTitle.setText("TextTitle");

xml代码是:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
android:layout_width="match_parent" android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical" >



<android.support.v7.widget.Toolbar android:id="@+id/toolbar_form"
    android:gravity="center"
    android:background="@color/white" android:minHeight="?attr/actionBarSize"
    android:layout_width="match_parent" android:layout_height="wrap_content">

    <TextView android:id="@+id/toolbar_form_title" android:layout_gravity="center"
        android:textSize="22sp" android:textColor="@color/toolbat_title_color"
        android:layout_width="wrap_content" android:layout_height="wrap_content" />

</android.support.v7.widget.Toolbar>

<ScrollView
    android:layout_margin="@dimen/activity_form_margin"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">


// more views

</ScrollView>

我做错了什么?我的工具栏中的“隐形”工具栏来自哪里?谢谢!

0 个答案:

没有答案