【发布时间】:2016-08-21 07:45:51
【问题描述】:
我正在使用“android.support.v7.widget.Toolbar”中的工具栏。
在您的 android 应用程序中添加(标准)图标的最佳方式是什么?
我做了什么……
- 我从这个网站下载了图标(24dp,白色):https://design.google.com/icons/
- 解压压缩文件并将每个图标放入应用程序中的指定文件夹(hdpi、mdpi、xhdpi、xxhdpi、xxxhdpi)
- 我将 mdpi 图标添加到文件夹(Resources/Drawable)
现在我引用布局中的图标,如:
android:icon="@drawable/ic_search_white_24dp"
但是我的图标有点模糊。 我做错了什么?
工具栏
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
local:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
local:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
我链接到图标的搜索视图
<menu
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"
tools:context=".MainActivity">
<item
android:id="@+id/action_search"
android:orderInCategory="200"
android:title="Zoeken"
android:icon="@drawable/ic_search_white_24dp"
app:showAsAction="ifRoom|collapseActionView"
app:actionViewClass="android.support.v7.widget.SearchView"
android:inputType="textCapCharacters"/>
</menu>
【问题讨论】:
-
只是搜索你想要的图标还是有更多图标?
-
它更像是每个图标(在未来)。我下载的所有图标似乎有点模糊,所以我认为我做错了什么。
-
同时添加您的工具栏布局代码
-
我添加了布局代码。
-
我通常使用 36dp 图像作为工具栏。检查我的示例答案
标签: android xamarin icons material-design toolbar