Skip to content

Commit

Permalink
Set weight for tab items
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshixin committed Sep 3, 2016
1 parent b3c2d19 commit 24a9014
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

/**
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 24a9014

Please sign in to comment.