bottomnavigationview

findViewById(R.id.icon) returns null

℡╲_俬逩灬. 提交于 2019-12-04 21:42:59
R.id.icon is already defined in Android API level 1. However, I am getting an NPE in a Android Design Support Library internal code while accessing an imageview inflated using R.id.icon . NOTE: I am not targetting Oreo as my targetSdk is currently 25 . Here is the stacktrace: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.widget.ImageView.getLayoutParams()' on a null object reference at android.support.design.internal.BottomNavigationItemView.setChecked(BottomNavigationItemView.java:172) at android.support.design

Android bottom navigation bar customization

白昼怎懂夜的黑 提交于 2019-12-04 14:02:55
问题 I have successfully implementing simple bottom bar and it looks like picture 1. But I wanted to customize it further so it can looks like the bottom bar in Youtube's android apps, which when you clicked in one of the item, it will spread shadowing effect. My current bottom bar: Youtube's bottom bar I would also like to customize it to look like the one in the official site with some animation when items are clicked. Any snippet or tutorial links would be appreciated. Thanks 回答1: try this

How to add the middle Button in BottomBar layout android

こ雲淡風輕ζ 提交于 2019-12-04 10:55:44
I want to add facebook messenger like oversized button in the middle of my bottombar layout but confused how to add.. Facebook Messenger I was using ahbottomnavigation library for making my bottombar. I just tried to make it simple, not professional type. Look here: BottomSheetLayout file - tv.xml : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:bottom="2dp" android:left="2dp" android:right="2dp" android:top="15dp"> <shape android:shape="rectangle"> <solid android:color="@color/colorPrimary" /> </shape> </item> <item

How to create the custom item of Bottomnavigationview Android?

折月煮酒 提交于 2019-12-04 06:44:06
I am using the Bottomnavigationview for tab-bar in my application, for it, i am using the following code.Please check it once. Layout :- <android.support.design.widget.BottomNavigationView android:id="@+id/bottom_navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" app:itemTextColor="@android:color/black" app:menu="@menu/bottom_navigation_main" /> And I get the following Result from it, please check the image for it. But the problem is that , I need the custom item of the Bottomnavigationview , like in below image there is

Badge on BottomNavigationView

微笑、不失礼 提交于 2019-12-04 03:07:58
问题 I am trying to add a badge to the BottomNavigationView Item without using any library, however somehow the BottomNavigationView is not showing the badge (custom_view) main_view.xml: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen

BottomNavigationView overlapping FrameLayout in CoordinatorLayout

耗尽温柔 提交于 2019-12-04 02:11:54
The following is my layout xml. The problem now is that the BottomNavigationView is overlapping the FrameLayout. I wanted the FrameLayout to stretch to the top of the BottomNavigationView. I tried with trick such as adding paddingBottom in the FrameLayout but I wonder if there is other better solution. Thanks. <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout

How to Set selected item in BottomNavigationView

人走茶凉 提交于 2019-12-03 19:21:01
问题 I am trying to set default item on activity created but it isn't working? This is my code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_userhome); mTextMessage = (TextView) findViewById(R.id.message); profile = (FrameLayout) findViewById(R.id.profile); mall = (FrameLayout) findViewById(R.id.mall); dietplan =(FrameLayout) findViewById(R.id.dietplan); BottomNavigationView navigation = (BottomNavigationView)

Flutter update BottomNavigationBar

▼魔方 西西 提交于 2019-12-03 09:11:45
I am using a BottomNavigationBar together with a TabController. By clicking on the different Tabs of the BottomNavigationBar the TabView is changing the content. However if I swipe on the TabView to switch to another view/tab the BottomNavigationBar is not updating to the tab I swiped to. I already have added a listener to the TabController to detect changes. But how can I update BottomNavigationBar programmatically to reflect the change? I think it is way more elegant to use PageView instead of TabBarView specially in your case. class BottomBarExample extends StatefulWidget { @override

Changing BottomNavigationView's Icon Size

孤人 提交于 2019-12-03 07:36:07
问题 I have been experimenting with the new BottomNavigationView and trying to customise it. So far I have managed to change the height and margins by using the below: <dimen name="design_bottom_navigation_height" tools:override="true">75dp</dimen> <dimen name="design_bottom_navigation_margin" tools:override="true">5dp</dimen> I want to increase the size of the icons. How can this be done? Compile Version: com.android.support:design:25.0.1 回答1: Late but Latest Use implementation 'com.android

BottomNavigationView - How to avoid recreation of Fragments and reuse them

有些话、适合烂在心里 提交于 2019-12-03 07:20:53
问题 I would like to make a bottom navigation bar in my project. Every view has it's own fragment. The problem is that every time i click on the button to change the view for example from recents to favorites it creates new fragment with completely new states(e.g. scroll position, text changed whatever my fragment contains). I know that in official Android documentation there was written that bottom navigation bar should reset the task states, but i think it is too uncomfortable for users. I would