如何隐藏/取消隐藏在Android 3的动作条列表? [英] how to hide/unhide the actionbar list on android 3?

查看:194
本文介绍了如何隐藏/取消隐藏在Android 3的动作条列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的Andr​​oid 3.0动作条带有下拉和searchWidget。

我想,当用户展开搜索,以隐藏下拉和取消隐藏下拉当用户关闭搜索。

下面是图片说明bettere

和这里是$ C $词的使用,使下拉

 动作条酒吧= this.getActionBar();
        bar.setTitle(this.getString(R.string.app_name));
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
...
        ListDittaListener监听器=新ListDittaListener(本);
        bar.setListNavigationCallbacks(seleziona_ditta,监听器);
 

解决方案

由于这种 http://stackoverflow.com/a/五十七万九千六百四十六分之六百四十五万四千二百八十八

  searchView.setOnSearchClickListener(新OnClickListener(){

            @覆盖
            公共无效的onClick(视图v){
                Log.v(MyApp.TAG,搜索视图在搜索点击);


                动作条酒吧= FattureActivity.this.getActionBar();
                bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            }
        });



        sea​​rchView.setOnCloseListener(新OnCloseListener(){

            @覆盖
            公共布尔的OnClose(){
                Log.v(MyApp.TAG,搜索视图在关闭);


                动作条酒吧= FattureActivity.this.getActionBar();

                bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);


                返回false;
            }
        });
 

i am using android 3.0 actionbar with a dropdown and a searchWidget.

I would like to hide the dropdown when the user expands the search and unhide the dropdown when the user closes the search.

Here is a picture to explain bettere

and here is the code i use to make the dropdown

ActionBar bar = this.getActionBar();
        bar.setTitle(this.getString(R.string.app_name));
        bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
...
        ListDittaListener listener = new ListDittaListener(this);
        bar.setListNavigationCallbacks( seleziona_ditta, listener);

解决方案

Thanks to this http://stackoverflow.com/a/6454288/579646

searchView.setOnSearchClickListener( new OnClickListener() {

            @Override
            public void onClick(View v) {
                Log.v(MyApp.TAG, "search view On Search Click");


                ActionBar bar = FattureActivity.this.getActionBar();
                bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            }
        });



        searchView.setOnCloseListener( new OnCloseListener() {

            @Override
            public boolean onClose() {
                Log.v(MyApp.TAG, "search view On Close");


                ActionBar bar = FattureActivity.this.getActionBar();

                bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);


                return false;
            }
        });

这篇关于如何隐藏/取消隐藏在Android 3的动作条列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆