如果我使用支持库26,为什么选项菜单项会被挤压?

时间:2017-08-01 04:49:33

标签: android android-support-library

选项菜单项具有支持库25应该具有的大小但是当我使用26.0.0时,它们都被挤压了。

菜单项xml

<?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/people"
        android:icon="@drawable/icon_addfriends_newsfeed"
        android:title=""
        app:showAsAction="always" />
</menu>

AppCompatActivity中的onCreateOptionsMenu

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.newsfeed, menu);
    return true;
}

工具栏布局

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

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimaryDark"
        android:theme="@style/ToolbarColoredBackArrow"
        app:popupTheme="@style/AppTheme.PopupOverlay"/>

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

25

26.0.0

1 个答案:

答案 0 :(得分:3)

该项目没有针对不同屏幕尺寸的图标。因此,我针对不同的屏幕尺寸生成了Android Asset Studio的图标。我选择了&#34;动作栏/标签图标生成器&#34;在我做的时候在Android Asset Studio中。我将这些图标添加到项目中。我清理了项目并编译了它。它终于得到了解决。