Issue
Noob here. First time learning to develop Android apps. Using Kotlin. Sorry if this has been answered already but the closest answer I found was in Java. I couldn't get it to work.
Please how can I increase the size of the icons in the bottom navigation bar? Also, how can I reduce/remove the white space that appears after I take out the text for the icons. I want the bar to look like the Twitter app bottom navigation bar. Please find my screen grab below.
A screen grab of the app showing the bottom nav bar
Solution
Try this in your activity
var i = 0
val navigationMenuViews = bottomNavigationView.getChildAt(0) as BottomNavigationMenuView
while (i < navigationMenuViews.childCount) {
val iconView = navigationMenuViews.getChildAt(i).findViewById(android.support.design.R.id.icon) as ImageView
val layoutParams = iconView.layoutParams
layoutParams.height = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48F, resources.displayMetrics).toInt()
layoutParams.width = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48F, resources.displayMetrics).toInt()
iconView.layoutParams = layoutParams
i++
}
Answered By - Brijesh Joshi
Answer Checked By - Gilberto Lyons (JavaFixing Admin)