diff --git a/bottom-navigation/src/main/java/com/chenshixin/bottomnavigation/BottomNavigationBar.kt b/bottom-navigation/src/main/java/com/chenshixin/bottomnavigation/BottomNavigationBar.kt index 63d4156..78b2696 100644 --- a/bottom-navigation/src/main/java/com/chenshixin/bottomnavigation/BottomNavigationBar.kt +++ b/bottom-navigation/src/main/java/com/chenshixin/bottomnavigation/BottomNavigationBar.kt @@ -69,6 +69,8 @@ class BottomNavigationBar(context: Context, attrs: AttributeSet) : FrameLayout(c if (items.isEmpty()) { return } + tabs.clear() + bottom_navigation_bar_item_container.removeAllViews() //TODO parse xml here ViewCompat.setElevation(this, 24F) bottom_navigation_bar_item_container.removeAllViews() diff --git a/bottom-navigation/src/main/java/com/chenshixin/bottomnavigation/BottomNavigationTab.kt b/bottom-navigation/src/main/java/com/chenshixin/bottomnavigation/BottomNavigationTab.kt index 07c8bb5..2f08d7e 100644 --- a/bottom-navigation/src/main/java/com/chenshixin/bottomnavigation/BottomNavigationTab.kt +++ b/bottom-navigation/src/main/java/com/chenshixin/bottomnavigation/BottomNavigationTab.kt @@ -9,6 +9,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.FrameLayout +import android.widget.LinearLayout import kotlinx.android.synthetic.main.bottom_navigation_tab.view.* /** @@ -40,7 +41,8 @@ class BottomNavigationTab(item: BottomNavigationItem, itemWidth: Int, val titleC init { LayoutInflater.from(context).inflate(R.layout.bottom_navigation_tab, this, true) - val params = ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT) + val params = LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT) + params.weight = 1F params.width = itemWidth layoutParams = params setBadgeNumber(item.number)