diff options
author | Aurelien Hubert <aurel.hubert@gmail.com> | 2016-04-04 19:45:15 +0200 |
---|---|---|
committer | Aurelien Hubert <aurel.hubert@gmail.com> | 2016-04-04 19:45:15 +0200 |
commit | 388534bec48f8b47a3d6847b5200b8cfe22297c2 (patch) | |
tree | 61ac1b4960d1a6d6c1f03528c9920d35e886a1bd /ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation | |
parent | 8066ddfdb952b1ca38652855c61840676a8567b9 (diff) | |
download | android_external_ahbottomnavigation-388534bec48f8b47a3d6847b5200b8cfe22297c2.tar.gz android_external_ahbottomnavigation-388534bec48f8b47a3d6847b5200b8cfe22297c2.tar.bz2 android_external_ahbottomnavigation-388534bec48f8b47a3d6847b5200b8cfe22297c2.zip |
Fixed the backgroundView height
Diffstat (limited to 'ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation')
-rw-r--r-- | ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java index cacbd01..4e2a3f7 100644 --- a/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java +++ b/ahbottomnavigation/src/main/java/com/aurelhubert/ahbottomnavigation/AHBottomNavigation.java @@ -136,12 +136,15 @@ public class AHBottomNavigation extends FrameLayout { } else if (items.size() > MAX_ITEMS) { Log.w(TAG, "The items list should not have more than 5 items"); } + + int layoutHeight = (int) resources.getDimension(R.dimen.bottom_navigation_height); + removeAllViews(); views.clear(); backgroundColorView = new View(context); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && colored) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { LayoutParams backgroundLayoutParams = new LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + ViewGroup.LayoutParams.MATCH_PARENT, layoutHeight); addView(backgroundColorView, backgroundLayoutParams); } @@ -149,7 +152,6 @@ public class AHBottomNavigation extends FrameLayout { linearLayout.setOrientation(LinearLayout.HORIZONTAL); linearLayout.setGravity(Gravity.CENTER); - int layoutHeight = (int) resources.getDimension(R.dimen.bottom_navigation_height); LayoutParams layoutParams = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, layoutHeight); addView(linearLayout, layoutParams); @@ -422,6 +424,7 @@ public class AHBottomNavigation extends FrameLayout { items.get(itemIndex).getColor(context)); } else { setBackgroundColor(defaultBackgroundColor); + backgroundColorView.setBackgroundColor(Color.TRANSPARENT); } } else if (i == currentItem) { @@ -519,6 +522,7 @@ public class AHBottomNavigation extends FrameLayout { items.get(itemIndex).getColor(context)); } else { setBackgroundColor(defaultBackgroundColor); + backgroundColorView.setBackgroundColor(Color.TRANSPARENT); } } else if (i == currentItem) { @@ -938,6 +942,7 @@ public class AHBottomNavigation extends FrameLayout { updateNotifications(true); } + //////////////// // INTERFACES // //////////////// |