Unwanted Bottom Margin on Oneplus Devices
ShivamArora opened this issue · 5 comments
encountered same issue using Huawei Nova 3i, fixed by removing lines 126-133 on this class FlashbarContainerView, hi @aritraroy please update the Repository :)
I have the same issue.
@charlest05 Hi dear, I have to clone and use that as module in the project ?
Same error
I got the Fix.
I had faced this issue on many MI devices. In internal fun adjustOrientation(activity: Activity)
inside FlashbarContainerView.kt
, I logged the navigationBarSize. Snackbar adds the bottom margin equal to the height of the navigation bar so that it doesn't overlap on the navigation bar. But activity.getNavigationBarSizeInPx()
returns wrong size in many devices. Resulting in gap at the bottom or extra margin between the snack bar and navigation bar.
In function, I have changed the way how it retrieves navigation bar size and now it works fine. :)
internal fun adjustOrientation(activity: Activity) {
val flashbarContainerViewLp = RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)
var resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
val navigationBarPosition = activity.getNavigationBarPosition()
var navigationBarSize = 0
if (resourceId > 0) {
navigationBarSize = resources.getDimensionPixelSize(resourceId);
}
when (navigationBarPosition) {
LEFT -> flashbarContainerViewLp.leftMargin = navigationBarSize
RIGHT -> flashbarContainerViewLp.rightMargin = navigationBarSize
BOTTOM -> flashbarContainerViewLp.bottomMargin = navigationBarSize
}
layoutParams = flashbarContainerViewLp
}