压扁图标工具栏更改为Android SDK中26后

DChiuch:

改变从编译/目标SDK V25我的应用程序SDK V26后,所有的在我的应用程序的工具栏菜单图标现在压扁/压扁/拉伸。

下面是相关的布局代码:

            <android.support.design.widget.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <android.support.v7.widget.Toolbar
                    android:id="@+id/toolbar"
                    android:layout_width="match_parent"
                    android:layout_height="?attr/actionBarSize"
                    android:background="?attr/colorPrimary"
                    android:theme="@style/AppTheme.AppBarOverlay" />

                <br.com.mauker.materialsearchview.MaterialSearchView
                    android:id="@+id/search_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />

            </RelativeLayout>

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

下面是squishes的菜单:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<item android:id="@+id/action_search"
    android:title="@string/search"
    android:icon="@drawable/ic_search_white_48dp"
    app:showAsAction="ifRoom" />

<item
    android:id="@+id/advanced_search"
    android:enabled="true"
    android:title="@string/advanced_search"
    app:showAsAction="never" />

</menu>

这里的另一个菜单squishes(他们都做):

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">

<item
    android:id="@+id/add_photo"
    android:enabled="true"
    android:title="@string/add_photo"
    android:icon="@drawable/ic_add_a_photo_white_48dp"
    app:showAsAction="ifRoom" />

</menu>

它是如何看起来SDK V25

它是如何看起来SDK V26

Galya:

该问题是,图标大小越大则预期。显然,缩放机制SDK 26已经改变,现在它导致了这种用户界面错误。确保工具栏图标以下尺寸中提供的资源。

更新:

由于工具栏最低高度abc_action_bar_default_height_material56dpabc_action_bar_icon_vertical_padding_material16dp,工具栏图标是为了符合的最小尺寸24dp在MDPI:

drawable-mdpi - 24 x 24 px
drawable-hdpi - 36 x 36 px
drawable-xhdpi - 48 x 48 px
drawable-xxhdpi - 72 x 72 px
drawable-xxxhdpi - 96 x 96 px

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章