com.google.android.material.internal.NavigationMenuView Java Examples
The following examples show how to use
com.google.android.material.internal.NavigationMenuView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NavigationViewUtil.java From a with GNU General Public License v3.0 | 5 votes |
/** * 去掉navigationView的滚动条 * @param navigationView NavigationView */ public static void disableScrollbar(NavigationView navigationView) { if (navigationView != null) { NavigationMenuView navigationMenuView = (NavigationMenuView) navigationView.getChildAt(0); if (navigationMenuView != null) { navigationMenuView.setVerticalScrollBarEnabled(false); } } }
Example #2
Source File: NavigationViewUtil.java From MyBookshelf with GNU General Public License v3.0 | 5 votes |
/** * 去掉navigationView的滚动条 * * @param navigationView NavigationView */ public static void disableScrollbar(NavigationView navigationView) { if (navigationView != null) { NavigationMenuView navigationMenuView = (NavigationMenuView) navigationView.getChildAt(0); if (navigationMenuView != null) { navigationMenuView.setVerticalScrollBarEnabled(false); } } }
Example #3
Source File: DynamicScrollUtils.java From dynamic-support with Apache License 2.0 | 5 votes |
/** * Set edge effect or glow color for navigation view. * * @param navigationView The navigation view to set the edge effect color. * @param color The edge effect color to be set. */ public static void setEdgeEffectColor( @NonNull NavigationView navigationView, @ColorInt int color) { initializeNavigationViewFields(); try { NavigationMenuPresenter presenter = (NavigationMenuPresenter) F_NAVIGATION_VIEW_PRESENTER.get(navigationView); NavigationMenuView navigationMenuView = (NavigationMenuView) F_NAVIGATION_VIEW_RECYCLER_VIEW.get(presenter); setEdgeEffectColor(navigationMenuView, color, null); } catch (Exception ignored) { } }
Example #4
Source File: DynamicScrollUtils.java From dynamic-support with Apache License 2.0 | 5 votes |
/** * Set scroll bar color for navigation view. * * @param navigationView The navigation view to set the scroll bar color. * @param color The edge effect color to be set. */ public static void setScrollBarColor( @NonNull NavigationView navigationView, @ColorInt int color) { initializeNavigationViewFields(); try { NavigationMenuPresenter presenter = (NavigationMenuPresenter) F_NAVIGATION_VIEW_PRESENTER.get(navigationView); NavigationMenuView navigationMenuView = (NavigationMenuView) F_NAVIGATION_VIEW_RECYCLER_VIEW.get(presenter); setScrollBarColor(navigationMenuView, color); } catch (Exception ignored) { } }
Example #5
Source File: ArcNavigationView.java From ArcNavigationView with Apache License 2.0 | 5 votes |
@Override protected void measureChild(View child, int parentWidthMeasureSpec, int parentHeightMeasureSpec) { if (child instanceof NavigationMenuView) { child.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec( getMeasuredHeight(), MeasureSpec.EXACTLY)); } else { super.measureChild(child, parentWidthMeasureSpec, parentHeightMeasureSpec); } }
Example #6
Source File: ArcNavigationView.java From ArcNavigationView with Apache License 2.0 | 5 votes |
private void calculateLayoutAndChildren() { if (settings == null) { return; } height = getMeasuredHeight(); width = getMeasuredWidth(); if (width > 0 && height > 0) { clipPath = createClipPath(); ViewCompat.setElevation(this, settings.getElevation()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setOutlineProvider(new ViewOutlineProvider() { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override public void getOutline(View view, Outline outline) { if (clipPath.isConvex()) { outline.setConvexPath(clipPath); } } }); } final int count = getChildCount(); for (int i = 0; i < count; i++) { final View v = getChildAt(i); if (v instanceof NavigationMenuView) { v.setBackground(settings.getBackgroundDrawable()); ViewCompat.setElevation(v, settings.getElevation()); //TODO: adjusting child views to new width in their rightmost/leftmost points related to path // adjustChildViews((ViewGroup) v); } } } }
Example #7
Source File: FloatingNavigationView.java From Floating-Navigation-View with Apache License 2.0 | 5 votes |
public FloatingNavigationView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); setImageResource(R.drawable.ic_menu_vector); mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); mNavigationView = (CircularRevealNavigationView) LayoutInflater.from(context).inflate(R.layout.navigation_view, null); mNavigationView.setBackground(new ColorDrawable(getBackgroundColor())); mNavigationView.setOnTouchListener(mNavigationTouchListener); mNavigationMenuView = (NavigationMenuView) mNavigationView.findViewById(R.id.design_navigation_view); mFabView = (ImageView) mNavigationView.findViewById(R.id.fab_view); mFabView.setOnClickListener(mFabClickListener); mFabView.setContentDescription(getContentDescription()); mFabView.bringToFront(); // Custom attributes TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MenuView, defStyleAttr, R.style.Widget_Design_NavigationView); if (a.hasValue(R.styleable.MenuView_menu)) { mNavigationView.inflateMenu(a.getResourceId(R.styleable.MenuView_menu, 0)); } if (a.hasValue(R.styleable.MenuView_headerLayout)) { mNavigationView.inflateHeaderView(a.getResourceId(R.styleable.MenuView_headerLayout, 0)); } mDrawMenuBelowFab = a.getBoolean(R.styleable.MenuView_drawMenuBelowFab, false); a.recycle(); }
Example #8
Source File: NavigationDrawerFragment.java From NGA-CLIENT-VER-OPEN-SOURCE with GNU General Public License v2.0 | 5 votes |
private void initNavigationView(View rootView) { NavigationView navigationView = rootView.findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this::onOptionsItemSelected); MenuItem menuItem = navigationView.getMenu().findItem(R.id.menu_gun); NavigationMenuView menuView = (NavigationMenuView) navigationView.getChildAt(0); menuView.setVerticalScrollBarEnabled(false); View actionView = getLayoutInflater().inflate(R.layout.nav_menu_action_view_gun, null); menuItem.setActionView(actionView); menuItem.expandActionView(); mReplyCountView = actionView.findViewById(R.id.reply_count); mHeaderView = navigationView.getHeaderView(0).findViewById(R.id.viewFlipper); updateHeaderView(); }