小编mic*_*tbs的帖子

导航抽屉菜单图标未正确显示

我想将自定义图标输入到导航栏中的菜单中.但是,当我运行应用程序时,它只显示图标的阴影.如何正确显示图像?

在此输入图像描述

这是菜单activity_main_drawer.xml的xml文件:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <group android:checkableBehavior="single">
        <item
            android:id="@+id/recent_picture"
            android:icon="@mipmap/ic_recent"
            android:title="Import" />
        <item
            android:id="@+id/nav_gallery"
            android:icon="@drawable/ic_menu_gallery"
            android:title="Gallery" />
        <item
            android:id="@+id/nav_slideshow"
            android:icon="@drawable/ic_menu_slideshow"
            android:title="Slideshow" />
        <item
            android:id="@+id/nav_manage"
            android:icon="@drawable/ic_menu_manage"
            android:title="Tools" />
    </group>
</menu>
Run Code Online (Sandbox Code Playgroud)

这是带有导航视图的xml布局:

<?xml version="1.0" encoding="utf-8"?>
<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_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)

在values文件夹中找到另一个drawables.xml文件.

<resources xmlns:android="http://schemas.android.com/apk/res/android">
<item name="ic_recent_picture" type="drawable">@mipmap/ic_recent</item>
<item name="ic_menu_gallery" type="drawable">@drawable/ic_menu_gallery</item>
<item name="ic_menu_slideshow" type="drawable">@android:drawable/ic_menu_slideshow</item>
<item name="ic_menu_manage" type="drawable">@android:drawable/ic_menu_manage</item>
<item name="ic_menu_share" type="drawable">@android:drawable/ic_menu_share</item>
<item name="ic_menu_send" type="drawable">@android:drawable/ic_menu_send</item>
Run Code Online (Sandbox Code Playgroud)

icons android menu

10
推荐指数
2
解决办法
5694
查看次数

Glide Process 'command 'git'' 以非零退出值 128 结束

我已经从 Github 下载了 Glide,想在 Android Studio 上测试该程序。但是一旦我清理了项目,我就会遇到这个错误

Information:Gradle tasks [clean]
fatal: Not a git repository (or any of the parent directories): .git
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred evaluating settings 'glide-master'.
> Process 'command 'git'' finished with non-zero exit value 128
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Information:BUILD FAILED
Information:Total time: 0.28 secs
Error:fatal: Not a git …
Run Code Online (Sandbox Code Playgroud)

git android gradle android-glide

8
推荐指数
2
解决办法
2万
查看次数

标签 统计

android ×2

android-glide ×1

git ×1

gradle ×1

icons ×1

menu ×1