Kitkat中NavigationView和Toolbar的兼容性

时间:2015-07-27 12:28:34

标签: android navigation-drawer material-design navigationview

我正在尝试运行该项目,并且在Lollipop设备中非常酷(设计等等,没有任何问题)

但是在这个项目中存在一个问题,我在class Program { static void Main(string[] args) { dynamic d = 0; Test test = new Test(); int x = test.TestDynamic(d); int y = test.TestInt(0); } } public class Test { public int TestDynamic(dynamic data) { return 0; } public int TestInt(int data) { return 0; } } 中没有任何关于这种兼容性的经验。安装后:

http://i.imgur.com/KSYkyeu.png  我正在使用:https://github.com/AkashBang/NavigationView

这里是激活主体:

Kitkat

主题:针对此活动

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:custom="http://schemas.android.com/tools"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".MainActivity">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe_refresh_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/v"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:weightSum="1">

            <include
                android:id="@+id/toolbar"
                layout="@layout/tool_bar">
            </include>

            <com.daimajia.slider.library.SliderLayout
                android:id="@+id/slider"
                android:layout_width="match_parent"
                android:layout_height="175dp"
                android:elevation="2dp"
                custom:auto_cycle="true"
                custom:indicator_visibility="invisible"
                custom:pager_animation="Accordion"
                custom:pager_animation_span="1000" />

            <Button
                android:id="@+id/btncat"
                android:layout_width="300dp"
                android:layout_height="55dp"
                android:layout_gravity="center"
                android:drawableStart="@drawable/ic_home"
                android:paddingEnd="40dp"
                android:paddingStart="20sp"
                android:text="@string/category"
                android:textColor="#FFFFFF"
                android:textDirection="ltr" />

            <android.support.v7.widget.CardView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="9dp"
                android:layout_marginRight="9dp"
                android:layout_marginTop="1dp"
                android:clickable="true"
                android:foreground="?android:attr/selectableItemBackground"
                card_view:cardCornerRadius="3dp"
                card_view:cardElevation="3sp"
                card_view:cardUseCompatPadding="true">

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

            <RelativeLayout
                android:id="@+id/top_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <TextView
                    android:id="@+id/textView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_alignStart="@+id/cardview1"
                    android:layout_marginTop="30dp"
                    android:text="@string/rcrechome"
                    android:textAppearance="?android:attr/textAppearanceLarge" />

                <android.support.v7.widget.CardView
                    android:id="@+id/cardview1"
                    android:layout_width="120dp"
                    android:layout_height="180dp"
                    android:layout_below="@+id/textView"
                    android:layout_marginEnd="9dp"
                    android:layout_marginStart="7dp"
                    android:layout_marginTop="20dp"
                    android:clickable="true"
                    android:foreground="?android:attr/selectableItemBackground"
                    card_view:cardCornerRadius="3dp"
                    card_view:cardElevation="3sp"
                    card_view:cardUseCompatPadding="true" />

                <android.support.v7.widget.CardView
                    android:id="@+id/cardview2"
                    android:layout_width="120dp"
                    android:layout_height="180dp"
                    android:layout_alignTop="@+id/cardview1"
                    android:layout_centerHorizontal="true"
                    android:clickable="true"
                    android:foreground="?android:attr/selectableItemBackground"
                    card_view:cardCornerRadius="3dp"
                    card_view:cardElevation="3sp"
                    card_view:cardUseCompatPadding="true" />

                <android.support.v7.widget.CardView
                    android:id="@+id/cardview3"
                    android:layout_width="120dp"
                    android:layout_height="180dp"
                    android:layout_alignParentEnd="true"
                    android:layout_alignTop="@+id/cardview2"
                    android:layout_marginEnd="7dp"
                    android:clickable="true"
                    android:foreground="?android:attr/selectableItemBackground"
                    card_view:cardCornerRadius="3dp"
                    card_view:cardElevation="3sp"
                    card_view:cardUseCompatPadding="true" />

                <Button
                    android:id="@+id/button"
                    style="?android:attr/buttonStyleSmall"
                    android:layout_width="70dp"
                    android:layout_height="40dp"
                    android:layout_alignBaseline="@+id/textView"
                    android:layout_alignBottom="@+id/textView"
                    android:layout_alignEnd="@+id/cardview3"
                    android:text="@string/morebtn"
                    android:textColor="#ffffff" />
            </RelativeLayout>
        </LinearLayout>
    </ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/header"
        app:menu="@menu/drawer" />
</android.support.v4.widget.DrawerLayout>

工具栏代码:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorPrimary">@color/ColorPrimary</item>
        <item name="windowActionBar">false</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:colorButtonNormal">#43A047</item>

        <!-- Customize your theme here. -->
    </style>

但是,我无法弄清楚,为什么会发生这种情况?

干杯!

1 个答案:

答案 0 :(得分:0)

在V19版面和样式中删除它后,它正在工作。

<item name="android:windowTranslucentStatus">true</item>