本文整理匯總了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);
}