SearchView.clearFocus只能在同一个库组中调用(groupId = com.android.support)

时间:2016-12-19 15:10:51

标签: android android-lint

我在活动中定义了一个searchview,如下所示:

import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;

public class SearchActivity extends AppCompatActivity {
  @BindView(R.id.search_view) SearchView searchView;

  private void setupSearchView() {
      SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
      searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
      searchView.setIconified(false);          
      searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override public boolean onQueryTextSubmit(String s) {
          searchView.clearFocus();
          return true;
        }

        @Override public boolean onQueryTextChange(String s) {
          searchFor(s);
          return true;
        }
      });
    }
}

的build.gradle

androidBuildToolsVersion = "25.0.2"
androidMinSdkVersion = 16
androidTargetSdkVersion = 25
androidCompileSdkVersion = 25
supportVersion = '25.1.0'

分析(分析 - >检查代码) lint 工具报告以下问题:

  

SearchView.clearFocus只能在同一个库中调用   group(groupId = com.android.support)

我不确定我做错了什么,有人能为我提供解决方案吗?

0 个答案:

没有答案