當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。