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


Java BottomNavigationMenuView.getChildCount方法代码示例

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


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

示例1: disableShiftMode

import android.support.design.internal.BottomNavigationMenuView; //导入方法依赖的package包/类
public static void disableShiftMode(BottomNavigationView navigationView) {
    BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);

    try {
        Field shiftMode = menuView.getClass().getDeclaredField("mShiftingMode");
        shiftMode.setAccessible(true);
        shiftMode.setBoolean(menuView, false);
        shiftMode.setAccessible(false);

        for (int i = 0; i < menuView.getChildCount(); i++) {
            BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
            itemView.setShiftingMode(false);
            itemView.setChecked(itemView.getItemData().isChecked());
        }

    } catch (NoSuchFieldException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:20,代码来源:BottomNavigationViewHelper.java

示例2: centerMenuIcon

import android.support.design.internal.BottomNavigationMenuView; //导入方法依赖的package包/类
private void centerMenuIcon() {
    BottomNavigationMenuView menuView = getBottomMenuView();

    if (menuView != null) {
        for (int i = 0; i < menuView.getChildCount(); i++) {
            BottomNavigationItemView menuItemView = (BottomNavigationItemView) menuView.getChildAt(i);

            AppCompatImageView icon = (AppCompatImageView) menuItemView.getChildAt(0);

            FrameLayout.LayoutParams params = (LayoutParams) icon.getLayoutParams();
            params.gravity = Gravity.CENTER;

            menuItemView.setShiftingMode(true);
        }
    }
}
 
开发者ID:JonathandelaSen,项目名称:TheMovies,代码行数:17,代码来源:MyBottomNavigationView.java

示例3: disableShiftMode

import android.support.design.internal.BottomNavigationMenuView; //导入方法依赖的package包/类
public static void disableShiftMode(BottomNavigationView navigationView) {

        BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
        try {
            Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
            shiftingMode.setAccessible(true);
            shiftingMode.setBoolean(menuView, false);
            shiftingMode.setAccessible(false);

            for (int i = 0; i < menuView.getChildCount(); i++) {
                BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
                itemView.setShiftingMode(false);
                itemView.setChecked(itemView.getItemData().isChecked());
            }

        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }
 
开发者ID:miguoer,项目名称:ApplicationCollention,代码行数:20,代码来源:BottomNavigationViewHelper.java

示例4: disableShiftMode

import android.support.design.internal.BottomNavigationMenuView; //导入方法依赖的package包/类
/**
 * 取消BottomNavigationView各item切换时的位移动效
 *
 * @param navigationView 底部导航栏视图
 */
public static void disableShiftMode(BottomNavigationView navigationView) {

    BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
    try {
        Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
        shiftingMode.setAccessible(true);
        shiftingMode.setBoolean(menuView, false);
        shiftingMode.setAccessible(false);

        for (int i = 0; i < menuView.getChildCount(); i++) {
            BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
            itemView.setShiftingMode(false);
            itemView.setChecked(itemView.getItemData().isChecked());
        }

    } catch (NoSuchFieldException | IllegalAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:Implementist,项目名称:iReading,代码行数:25,代码来源:CommonUtils.java

示例5: disableShiftingMode

import android.support.design.internal.BottomNavigationMenuView; //导入方法依赖的package包/类
private void disableShiftingMode() {
    BottomNavigationMenuView menuView = (BottomNavigationMenuView) getChildAt(0);
    try {
        Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode");
        shiftingMode.setAccessible(true);
        shiftingMode.setBoolean(menuView, false);
        shiftingMode.setAccessible(false);
        for (int i = 0; i < menuView.getChildCount(); i++) {
            BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i);
            item.setShiftingMode(false);
            // Set the checked value so that the view will be updated.
            item.setChecked(item.getItemData().isChecked());
        }
    } catch (NoSuchFieldException | IllegalAccessException e) {
        // Do nothing if reflection fails.
    }
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:18,代码来源:BottomSheetContentController.java

示例6: getNavigationItemTitles

import android.support.design.internal.BottomNavigationMenuView; //导入方法依赖的package包/类
public static List<String> getNavigationItemTitles(BottomNavigationView navigationView) {
    List<String> list = new ArrayList<>();
    BottomNavigationMenuView menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
    for (int i = 0; i < menuView.getChildCount(); i++) {
        BottomNavigationItemView itemView = (BottomNavigationItemView) menuView.getChildAt(i);
        list.add((String) itemView.getItemData().getTitle());
    }
    return list;
}
 
开发者ID:InnoFang,项目名称:Android-Code-Demos,代码行数:10,代码来源:BottomNavigationViewHelper.java

示例7: onCreate

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

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    fragmentView = findViewById(R.id.fragment);
    navigationView = (BottomNavigationView) findViewById(R.id.navigation);

    View title = toolbar.getChildAt(0);
    if (title != null && title instanceof TextView)
        FontUtils.applyTypeface((TextView) toolbar.getChildAt(0));

    setSupportActionBar(toolbar);

    for (int i = 0; i < navigationView.getChildCount(); i++) {
        View child = navigationView.getChildAt(i);
        if (child instanceof BottomNavigationMenuView) {
            BottomNavigationMenuView menuView = (BottomNavigationMenuView) child;
            for (int i2 = 0; i2 < menuView.getChildCount(); i2++) {
                View item = menuView.getChildAt(i2);
                View smallTextView = item.findViewById(android.support.design.R.id.smallLabel);
                if (smallTextView != null && smallTextView instanceof TextView)
                    FontUtils.applyTypeface((TextView) smallTextView);

                View largeTextView = item.findViewById(android.support.design.R.id.largeLabel);
                if (largeTextView != null && largeTextView instanceof TextView)
                    FontUtils.applyTypeface((TextView) largeTextView);
            }
        }
    }

    navigationView.setOnNavigationItemSelectedListener(this);

    getSupportFragmentManager().addOnBackStackChangedListener(new FragmentManager.OnBackStackChangedListener() {
        @Override
        public void onBackStackChanged() {
            fragment = getSupportFragmentManager().findFragmentById(R.id.fragment);
            setSelection(fragment);
        }
    });

    if (savedInstanceState != null) {
        fragment = getSupportFragmentManager().findFragmentById(R.id.fragment);
        if (fragment != null) {
            setSelection(fragment);
            return;
        }
    }

    toolbar.setTitle(R.string.title_articles);
    fragment = new ListFragment();
    getSupportFragmentManager().beginTransaction().add(R.id.fragment, fragment).commit();
}
 
开发者ID:TheAndroidMaster,项目名称:APReader,代码行数:55,代码来源:MainActivity.java


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