自从升级不同版本以来糟糕的Searchview布局

时间:2016-06-02 21:52:47

标签: android

我将计算机升级到android studio 2.1.1 我升级了android的所有构建工具,现在我使用了appcompat-v7 / support-v4 / design的23.4.0

当我尝试在我的nexus 7设备(marschmallow)或galaxy s5(lolipop)上调试我的软件时,我有那种奇怪的布局 有人理解为什么吗?

problem with the searchview style

我对searchview的调用:

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.machines, menu);


    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default

    searchView.setOnQueryTextListener(this);
    searchView.setOnCloseListener(this);
    return true;
}

和xml资源:

 <android.support.v7.widget.Toolbar
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/Toolbar"
        app:popupTheme="@style/Theme.AppCompat.NoActionBar" />

当我删除这两个主题时,它具有相同的glich

0 个答案:

没有答案