小编Alo*_*lok的帖子

ActionBar在Android KitKat上不可见

我正在尝试使用android设计库实现工具栏.输出工作在棒棒糖和棉花糖设备如预期,但它没有奇巧上显示的设备工具栏.

我看到的堆栈溢出类似的帖子(here_1,here_2),并试图执行所列出的更改.但是,我无法在Kit Kat设备上使用它.

我在build.gradle文件中包含以下内容:

compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
Run Code Online (Sandbox Code Playgroud)

这是我的main_Activity.xml文件:

<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:fitsSystemWindows="true"
    android:theme="@style/Theme.MyMovie"
    tools:context=".MainActivity">


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


    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header"
        app:menu="@menu/drawer_view"/>

</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的include_grid_viewpager.xml文件:

<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:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Chalisa">

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

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar1"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways"
            app:popupTheme="@style/AppTheme.PopupOverlay"
            />

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

    <GridView
        android:id="@+id/gridview1"
        android:columnWidth="80dp"
        android:paddingTop="?attr/actionBarSize"
        android:gravity="center_horizontal"
        android:background="@drawable/stroke"
        android:numColumns="3"
        android:stretchMode="spacingWidthUniform"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
    </GridView>

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

这是我的style.xml文件

<resources>

    <style name="Theme.Mytheme" parent="Base.Theme.DesignDemo">
    </style>

    <style name="Base.Theme.DesignDemo" …
Run Code Online (Sandbox Code Playgroud)

xml android android-layout

1
推荐指数
1
解决办法
2407
查看次数

标签 统计

android ×1

android-layout ×1

xml ×1