bottom navigation bar not filling the width of the screen
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
....
if (mShiftingMode) {
final int inactiveCount = count - 1;
final int activeMaxAvailable = width - inactiveCount * mInactiveItemMinWidth;
final int activeWidth = Math.min(activeMaxAvailable, mActiveItemMaxWidth);
final int inactiveMaxAvailable = (width - activeWidth) / inactiveCount;
final int inactiveWidth = Math.min(inactiveMaxAvailable, mInactiveItemMaxWidth);
...
} else {
final int maxAvailable = width / count;
final int childWidth = Math.min(maxAvailable, mActiveItemMaxWidth);
.....
}
....
}
3.67
3
public BottomNavigationMenuView(Context context, AttributeSet attrs) {
super(context, attrs);
...
mInactiveItemMaxWidth = res.getDimensionPixelSize(
R.dimen.design_bottom_navigation_item_max_width);
....
mActiveItemMaxWidth = res.getDimensionPixelSize(
R.dimen.design_bottom_navigation_active_item_max_width);
.....
}
Thank you!
3
0
3.86
7
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="design_bottom_navigation_item_max_width" tools:override="true">600dp</dimen>
<dimen name="design_bottom_navigation_active_item_max_width" tools:override="true">600dp</dimen>
</resources>
Thank you!
7
0
Are there any code examples left?
New code examples in category Other