本文整理汇总了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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}