默认情况ListView下显示在我的SearchView包含文本下面的建议被截断.我希望文本完整显示(如有必要,可以在多行显示).
我已经提出了两种可能的方法来解决这个问题但是,由于没有在网上找到的例子,我希望有人在这里可以帮助...
方法#1/Q1:如何直接访问和修改包含SUGGEST_COLUMN_TEXT_1和SUGGEST_COLUMN_TEXT_1文本的TextView的外观?
方法#2/Q2:或者,SearchView有一个setSuggestionsAdapter(CursorAdapter adapter)看起来比方法#1更合适的方法(更多?).虽然我已经阅读了CursorAdapters并且已经在我的应用程序中实现了一个,但我不确定如何为SearchView配置一个(特别是在访问光标方面),所以任何人都可以帮我一些一般的指导还是一个骨架的例子?
以下是我的SearchViewFragment类中的现有代码:
public class SearchViewFragment extends Fragment {
public SearchViewFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View fragmentView = inflater.inflate(R.layout.fragment_search_view, container, false);
// Use the Search Manager to find the SearchableInfo related to this Activity
SearchManager searchManager = (SearchManager)getActivity().getSystemService(Context.SEARCH_SERVICE);
SearchableInfo searchableInfo = searchManager.getSearchableInfo(getActivity().getComponentName()); …Run Code Online (Sandbox Code Playgroud) customization android search-suggestion searchview android-cursoradapter