0

I am new to Android programming and I am trying to make an android version of an iOS app I have. In the iOS version I have a search bar controller and table view. The table view is initially populated with a list of data split into 4 sections. when any of the items are clicked it will push to a detail view with full screen image and title of the item. The search would then filter this list and the results would push in the same way.

I am looking to recreate this for android but when looking at exaples etc it never seems to be along the same lines.

Does anyone know how I can do this?

Thanks

4

1 回答 1

1

由于您的问题确实含糊不清(您谈论搜索,分段的 ListView,fullScreen 详细信息,..)我不能给您所有需要的答案,这意味着一个完整的应用程序。

首先,我不认为“我想让它像 iOS 一样工作”是最好的方法,因为您的用户习惯于 Android 搜索而不是 iOS 搜索,他们会迷路并发现您的应用程序不自然

如果您正在寻找创建搜索小部件,您应该使用 ActionBar 中的搜索小部件(使用 ActionBarSherlock 用于预蜂窝设备)

所有文档都可以在这里找到:http: //developer.android.com/guide/topics/search/search-dialog.html

在此处输入图像描述

此页面上还有许多链接,如果您仍有问题,最好是返回一个准确的问题

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the options menu from XML
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.options_menu, menu);

    // Get the SearchView and set the searchable configuration
    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
    SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
    // Assumes current activity is the searchable activity
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default

    return true;
}
于 2013-07-01T10:35:36.940 回答