• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OnNavigationListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.support.v7.app.ActionBar.OnNavigationListener的典型用法代码示例。如果您正苦于以下问题:Java OnNavigationListener类的具体用法?Java OnNavigationListener怎么用?Java OnNavigationListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OnNavigationListener类属于android.support.v7.app.ActionBar包,在下文中一共展示了OnNavigationListener类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setListNavigationCallbacks

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
public void setListNavigationCallbacks(SpinnerAdapter adapter, OnNavigationListener callback) {
    this.mDecorToolbar.setDropdownParams(adapter, new NavItemSelectedListener(callback));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:ToolbarActionBar.java


示例2: NavItemSelectedListener

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
public NavItemSelectedListener(OnNavigationListener listener) {
    this.mListener = listener;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:NavItemSelectedListener.java


示例3: onCreate

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    mSavedState = savedState;
    setContentView(R.layout.activity_standard_fragment);
    actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this,
            R.array.finances_tabs_names, R.layout.item_actionbar_spinner);
    ActionBar.OnNavigationListener mOnNavigationListener = new OnNavigationListener() {
        String[] tabNames = getResources().getStringArray(
                R.array.finances_tabs_names);

        @Override
        public boolean onNavigationItemSelected(int position, long rowId) {
            if (mSavedState != null) {
                int savedPosition = mSavedState.getInt(
                        BUNDLE_POSITION_NAME, Integer.MIN_VALUE);
                if (savedPosition != Integer.MIN_VALUE) {
                    mSavedState.putInt(BUNDLE_POSITION_NAME,
                            Integer.MIN_VALUE);
                    actionBar.setSelectedNavigationItem(savedPosition);
                    return false;
                } else {
                    if (previousPosition == position) {
                        return false;
                    }
                }
            }
            FragmentTransaction ft = getSupportFragmentManager()
                    .beginTransaction();
            switch (position) {
                case 0:
                    ft.replace(R.id.standardLayout, new BalanceFragment(),
                            tabNames[position]);
                    break;
                case 1:
                    ft.replace(R.id.standardLayout, new MyTradeFragment(),
                            tabNames[position]);
                    break;
                case 2:
                    ft.replace(R.id.standardLayout, new MyTransFragment(),
                            tabNames[position]);
                    break;
            }
            ft.commit();
            previousPosition = position;
            return true;
        }
    };
    actionBar.setListNavigationCallbacks(mSpinnerAdapter,
            mOnNavigationListener);
}
 
开发者ID:alexandersjn,项目名称:btc-e-assist,代码行数:56,代码来源:FinancesActivity.java


示例4: onCreate

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    mSavedState = savedState;
    setContentView(R.layout.activity_standard_fragment);
    actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this,
            R.array.chat_tabs_names, R.layout.item_actionbar_spinner);
    ActionBar.OnNavigationListener mOnNavigationListener = new OnNavigationListener() {
        String[] tabNames = getResources().getStringArray(
                R.array.chat_tabs_names);

        @Override
        public boolean onNavigationItemSelected(int position, long rowId) {
            if (mSavedState != null) {
                int savedPosition = mSavedState.getInt(
                        BUNDLE_POSITION_NAME, Integer.MIN_VALUE);
                if (savedPosition != Integer.MIN_VALUE) {
                    mSavedState.putInt(BUNDLE_POSITION_NAME,
                            Integer.MIN_VALUE);
                    actionBar.setSelectedNavigationItem(savedPosition);
                    return false;
                } else {
                    if (previousPosition == position) {
                        return false;
                    }
                }
            }
            FragmentTransaction ft = getSupportFragmentManager()
                    .beginTransaction();
            switch (position) {
                case 0:
                    ft.replace(R.id.standardLayout, new ChatFragment(),
                            tabNames[position]);
                    break;
                case 1:
                    ft.replace(R.id.standardLayout, new NewsFragment(),
                            tabNames[position]);
                    break;
            }
            ft.commit();
            previousPosition = position;
            return true;
        }
    };
    actionBar.setListNavigationCallbacks(mSpinnerAdapter,
            mOnNavigationListener);
}
 
开发者ID:alexandersjn,项目名称:btc-e-assist,代码行数:52,代码来源:ChatActivity.java


示例5: onCreate

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    mSavedState = savedState;
    setContentView(R.layout.activity_standard_fragment);
    actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this,
            R.array.profile_tabs_names, R.layout.item_actionbar_spinner);
    ActionBar.OnNavigationListener mOnNavigationListener = new OnNavigationListener() {
        String[] tabNames = getResources().getStringArray(
                R.array.profile_tabs_names);

        @Override
        public boolean onNavigationItemSelected(int position, long rowId) {
            if (mSavedState != null) {
                int savedPosition = mSavedState.getInt(
                        BUNDLE_POSITION_NAME, Integer.MIN_VALUE);
                if (savedPosition != Integer.MIN_VALUE) {
                    mSavedState.putInt(BUNDLE_POSITION_NAME,
                            Integer.MIN_VALUE);
                    actionBar.setSelectedNavigationItem(savedPosition);
                    return false;
                } else {
                    if (previousPosition == position) {
                        return false;
                    }
                }
            }
            FragmentTransaction ft = getSupportFragmentManager()
                    .beginTransaction();
            switch (position) {
                case 0:
                    ft.replace(R.id.standardLayout, new AddProfileFragment(),
                            tabNames[position]);
                    break;
                case 1:
                    ft.replace(R.id.standardLayout,
                            new SelectProfileFragment(), tabNames[position]);
                    break;
            }
            ft.commit();
            previousPosition = position;
            return true;
        }
    };
    actionBar.setListNavigationCallbacks(mSpinnerAdapter,
            mOnNavigationListener);
}
 
开发者ID:alexandersjn,项目名称:btc-e-assist,代码行数:52,代码来源:ProfileActivity.java


示例6: onCreate

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    mSavedState = savedState;
    setContentView(R.layout.activity_standard_fragment);
    fragmentManager = getSupportFragmentManager();
    actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this,
            R.array.ticker_tabs_names, R.layout.item_actionbar_spinner);
    ActionBar.OnNavigationListener mOnNavigationListener = new OnNavigationListener() {
        String[] tabNames = getResources().getStringArray(
                R.array.ticker_tabs_names);

        @Override
        public boolean onNavigationItemSelected(int position, long rowId) {
            if (mSavedState != null) {
                int savedPosition = mSavedState.getInt(
                        BUNDLE_POSITION_NAME, Integer.MIN_VALUE);
                if (savedPosition != Integer.MIN_VALUE) {
                    mSavedState.putInt(BUNDLE_POSITION_NAME,
                            Integer.MIN_VALUE);
                    actionBar.setSelectedNavigationItem(savedPosition);
                    return false;
                } else {
                    if (previousPosition == position) {
                        return false;
                    }
                }
            }
            FragmentTransaction ft = fragmentManager.beginTransaction();
            switch (position) {
                case 0:
                    ft.replace(R.id.standardLayout, new TickerFragment(),
                            tabNames[position]);
                    break;
                case 1:
                    ft.replace(R.id.standardLayout, new OrdersFragment(),
                            tabNames[position]);
                    break;
                case 2:
                    ft.replace(R.id.standardLayout, new TradesFragment(),
                            tabNames[position]);
                    break;
            }
            ft.commit();
            previousPosition = position;
            return true;
        }
    };
    actionBar.setListNavigationCallbacks(mSpinnerAdapter,
            mOnNavigationListener);
}
 
开发者ID:alexandersjn,项目名称:btc-e-assist,代码行数:56,代码来源:TickerActivity.java


示例7: onCreate

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedState) {
    super.onCreate(savedState);
    mSavedState = savedState;
    setContentView(R.layout.activity_standard_fragment);
    actionBar = getSupportActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(false);
    actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
    SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(this,
            R.array.assist_tabs_names, R.layout.item_actionbar_spinner);
    ActionBar.OnNavigationListener mOnNavigationListener = new OnNavigationListener() {
        String[] tabNames = getResources().getStringArray(
                R.array.assist_tabs_names);

        @Override
        public boolean onNavigationItemSelected(int position, long rowId) {
            if (mSavedState != null) {
                int savedPosition = mSavedState.getInt(
                        BUNDLE_POSITION_NAME, Integer.MIN_VALUE);
                if (savedPosition != Integer.MIN_VALUE) {
                    mSavedState.putInt(BUNDLE_POSITION_NAME,
                            Integer.MIN_VALUE);
                    actionBar.setSelectedNavigationItem(savedPosition);
                    return false;
                } else {
                    if (previousPosition == position) {
                        return false;
                    }
                }
            }
            FragmentTransaction ft = getSupportFragmentManager()
                    .beginTransaction();
            switch (position) {
                case 0:
                    ft.replace(R.id.standardLayout, new AssistAlarmFragment(),
                            tabNames[position]);
                    break;
                case 1:
                    ft.replace(R.id.standardLayout, new AssistTasksFragment(),
                            tabNames[position]);
                    break;
            }
            ft.commit();
            previousPosition = position;
            return true;
        }
    };
    actionBar.setListNavigationCallbacks(mSpinnerAdapter,
            mOnNavigationListener);
}
 
开发者ID:alexandersjn,项目名称:btc-e-assist,代码行数:52,代码来源:AssistActivity.java


示例8: setCallback

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
public void setCallback(OnNavigationListener callback) {
    mCallback = callback;
}
 
开发者ID:restorer,项目名称:gloomy-dungeons-2,代码行数:4,代码来源:ActionBarView.java


示例9: onCreate

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
@Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_reality_check);
       
       mActionBar = getSupportActionBar();
       mActionBar.setDisplayHomeAsUpEnabled(true);
       mActionBar.setDisplayShowTitleEnabled(false);
       mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
       
       final String[] dropdownValues = getResources().getStringArray(R.array.reality_check_items_array);;

       // Specify a SpinnerAdapter to populate the dropdown list.
       ArrayAdapter<String> adapter = new ArrayAdapter<String>(mActionBar.getThemedContext(), android.R.layout.simple_spinner_item, android.R.id.text1, dropdownValues);

       adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

       // Set up the dropdown list navigation in the action bar.
       mActionBar.setListNavigationCallbacks(adapter, new OnNavigationListener() {

		@Override
		public boolean onNavigationItemSelected(int position, long itemId) {
			switch (position) {
				case 0:
					RealityCheckListAdapter stepListAdapter = new RealityCheckListAdapter(RealityCheckActivity.this, R.layout.list_item_step_reality_check, mProcedure.getSteps());
			        mListView.setAdapter(stepListAdapter);
					break;
				case 1:
					CompareListAdapter step1ListAdapter = new CompareListAdapter(RealityCheckActivity.this, R.layout.list_item_step_compare, mProcedure.getSteps());
			        mListView.setAdapter(step1ListAdapter);
					break;
			}
			return true;
		}
       	
       });
       
       mProcedure = getIntent().getParcelableExtra("procedure");
       
       mListView = (ListView) findViewById(R.id.listView);
}
 
开发者ID:doolle89,项目名称:WATCHiT,代码行数:42,代码来源:RealityCheckActivity.java


示例10: setupActionBar

import android.support.v7.app.ActionBar.OnNavigationListener; //导入依赖的package包/类
private void setupActionBar() {
	// Set up the action bar to show a dropdown list.
	final ActionBar actionBar = ((MainActivity) getActivity())
			.getSupportActionBar();
	actionBar.setDisplayShowTitleEnabled(false);
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);

	// Specify a SpinnerAdapter to populate the dropdown list.
	mDropDownAdapter = new DropDrownProjectsListAdapter(
			actionBar.getThemedContext(),
			android.R.layout.simple_spinner_item,
			mInfoToLoadAtDropDownListOfActionBar);

	OnNavigationListener listener = new OnNavigationListener() {

		@Override
		public boolean onNavigationItemSelected(int position, long id) {
			// When the Navigation mode is activated, the source of
			// DropDownList (mInfoToLoadAtDropDownListOfActionBar) is empty,
			// because it is populate in an asynctask.
			// This condition must be check to avoid error.
			if (isDropDownListLoaded()) {
				mProjectIdToFilter = mInfoToLoadAtDropDownListOfActionBar
						.get(position).projectId;
				mLoadDataInListViewAsyncTask = new LoadDataInListViewAsyncTask();
				mLoadDataInListViewAsyncTask.execute(mProjectIdToFilter,
						Application
								.getTaskPriorityFilterValue(getActivity()));
			}
			return true;
		}
	};

	// Set up the dropdown list navigation in the action bar.
	actionBar.setListNavigationCallbacks(mDropDownAdapter, listener);

	// use getActionBar().getThemedContext() to ensure
	// that the text color is always appropriate for the action bar
	// background rather than the activity background.

}
 
开发者ID:Nescafemix,项目名称:TeamboxClient,代码行数:42,代码来源:TasksListFragment.java



注:本文中的android.support.v7.app.ActionBar.OnNavigationListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Marker类代码示例发布时间:2022-05-21
下一篇:
Java AsymmetricCipherKeyPair类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap