当前位置: 首页>>代码示例>>Java>>正文


Java BottomNavigationView.setSelectedItemId方法代码示例

本文整理汇总了Java中android.support.design.widget.BottomNavigationView.setSelectedItemId方法的典型用法代码示例。如果您正苦于以下问题:Java BottomNavigationView.setSelectedItemId方法的具体用法?Java BottomNavigationView.setSelectedItemId怎么用?Java BottomNavigationView.setSelectedItemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.design.widget.BottomNavigationView的用法示例。


在下文中一共展示了BottomNavigationView.setSelectedItemId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import android.support.design.widget.BottomNavigationView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_dashboard);

    BottomNavigationView navigation = findViewById(R.id.navigation);
    navigation.setSelectedItemId(R.id.navigation_marks);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);

    if (savedInstanceState != null) {
        currentFragment = getSupportFragmentManager().getFragment(savedInstanceState, "currentFragment");
        setTitle(savedInstanceState.getString("activityTitle"));
    } else {
        currentFragment = gradesFragment;
        setTitle(R.string.grades_text);
    }

    int cardID = getIntent().getIntExtra("cardID", 0);

    if (cardID == 1) {
        currentFragment = gradesFragment;
    }

    getSupportFragmentManager().beginTransaction()
            .replace(R.id.fragment_container, currentFragment).commit();
}
 
开发者ID:wulkanowy,项目名称:wulkanowy,代码行数:27,代码来源:DashboardActivity.java

示例2: onCreate

import android.support.design.widget.BottomNavigationView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_index_main);

    final BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(this);
    navigation.setSelectedItemId(R.id.navigation_style);

    //状态栏透明和间距处理
    StatusBarUtil.immersive(this, 0xff000000, 0.1f);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:IndexMainActivity.java

示例3: onCreate

import android.support.design.widget.BottomNavigationView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    BottomNavigationView bottomNavigationView = (BottomNavigationView)
            findViewById(R.id.bottom_navigation);
    bottomNavigationView.setOnNavigationItemSelectedListener(new CustomNavigationListener(this));
    bottomNavigationView.setSelectedItemId(R.id.action_sofa);
}
 
开发者ID:cyanide4all,项目名称:MySmashCouch,代码行数:11,代码来源:MainActivity.java

示例4: onCreate

import android.support.design.widget.BottomNavigationView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    realm=Realm.getDefaultInstance();
    navigation= (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
    navigation.setSelectedItemId(R.id.navigation_dashboard);

}
 
开发者ID:nyangate,项目名称:Crypto-Assistant,代码行数:11,代码来源:MainActivity.java

示例5: onBackPressed

import android.support.design.widget.BottomNavigationView; //导入方法依赖的package包/类
public void onBackPressed() {

        BottomNavigationView navigation = findViewById(R.id.navigation);

        if (navigation.getSelectedItemId() != R.id.navigation_dashboard) {
            navigation.setSelectedItemId(R.id.navigation_dashboard);
        } else if (navigation.getSelectedItemId() == R.id.navigation_dashboard) {
            moveTaskToBack(true);
        }
    }
 
开发者ID:wulkanowy,项目名称:wulkanowy,代码行数:11,代码来源:DashboardActivity.java

示例6: onCreate

import android.support.design.widget.BottomNavigationView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	final BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
	BottomNavigationViewHelper.disableShiftMode(navigation);
	navigation.setOnNavigationItemSelectedListener(this);
	navigation.setSelectedItemId(R.id.navigation_home);
}
 
开发者ID:xiaobaima520gyj,项目名称:imooc-imi-app,代码行数:10,代码来源:MainActivity.java

示例7: onCreate

import android.support.design.widget.BottomNavigationView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    int r = getIntent().getIntExtra("back_fragment",R.id.navigation_note);

    navigation = (BottomNavigationView) findViewById(R.id.navigation);
    navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
    navigation.setSelectedItemId(r);

}
 
开发者ID:hamzaolak,项目名称:SpecialNotebook,代码行数:13,代码来源:MainActivity.java


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