bottomnavigationview

Android - Add bottom navigation view dynamically

☆樱花仙子☆ 提交于 2019-12-24 10:00:47
问题 I try to add a bottom navigation view dynamically. I know that I add a navigation view inside activity's xml file. <android.support.design.widget.BottomNavigationView android:id="@+id/navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="start" design:menu="@menu/items" /> I don't want to create a item xml file. I used below code to create navigation bar. bottomNavigationView = new BottomNavigationView(this); ViewGroup.LayoutParams params

Hide bottom navigation bar on scroll down and vice versa

大城市里の小女人 提交于 2019-12-24 09:27:57
问题 I have a list in the body and bottom navigation bar. I want to hide bottom navigation bar with a slide down animation when the posts list is scrolled down and visible with a slide up animation when scrolled up. How to do it? 回答1: Here is the code. void main() => runApp(MaterialApp(home: Scaffold(body: MyApp()))); class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { ScrollController _scrollController; double

bottomnavigationview Fragment replacement with sub-fragment

拜拜、爱过 提交于 2019-12-24 06:37:36
问题 I have created an app with a bottom navigation fragment which consists of 5 main fragments and one extra sub fragment (login Fragment). the thing is I want this login fragment to be replaced with the userAccount fragment once user has logged in successfully. Note: I am running the App statically at first so I am using a variable Boolean Called Status to check whether user has logged in or not private static final boolean Status = false; final Fragment f1 = new HomeFragment(); final Fragment

BottomNavigationView - How to get selected menu item?

随声附和 提交于 2019-12-23 07:27:22
问题 I used BottomNavigationView to switch fragments. How to get currently selected menu item, to prevent reopening fragment ? BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation); bottomNavigationView.setOnNavigationItemSelectedListener( new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.action_1: // open fragment 1 break;

Bottom navigation view - gradient icon tint

偶尔善良 提交于 2019-12-23 02:22:15
问题 I have changed icon tint in BottomNavigationView using selector and gradient color as tint when icon is pressed, but instead changing icon tint to gradient Android made all my icon purple. My question is if there is any possibility to change tint of icons in BottomNavigationView to be gradient color? BottomNavigationCode: <com.google.android.material.bottomnavigation.BottomNavigationView android:id="@+id/nav_bottom_main" android:layout_width="match_parent" app:itemIconTint="@color/bottom_menu

How to know when Samsung S8, S8+, S9, ect bottom navigation bar is visible?

╄→尐↘猪︶ㄣ 提交于 2019-12-22 04:45:12
问题 The bottom navigation bar on Samsung S8, S8+, S9, ect causes a UI and animation nightmare for views moving in and out from top and bottom of my app when toggled off. For these devices if the navigation bar is toggle on everything works perfectly, but if toggled off the animations all fall short by approximately the height of the navigation bar. My idea is to adjust the animations, however, I am having a difficult time figuring out when a phone has a bottom navigation bar and it is toggled off

How to add the middle Button in BottomBar layout android

☆樱花仙子☆ 提交于 2019-12-21 18:04:52
问题 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. 回答1: 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=

FloatingActionButton with BottomNavigationView

守給你的承諾、 提交于 2019-12-21 03:58:07
问题 I cant position my FAB. It should be bottom right, but on top of the BottonNavigationView. 1) Can i achieve this without RelativeLayout inside coordinateLayout? 2) Show me how 3) Should i use FrameLayout as a container for fragments? <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent"

BottomNavigationView cause lag with image loading

冷暖自知 提交于 2019-12-20 03:49:11
问题 0 When I'm building my app, the image loading is very laggy. It seems to happen in conjuction with adding a BottomNavigationView or Toolbar, when they are removed app runs smoothly. Setup is a MainActivity and fragments loaded into it thru bottom nav bar. public class FragmentActivity extends AppCompatActivity { BottomNavigationView navi; FragmentTransaction fragmentTransaction; public static final String TAG = FragmentActivity.class.getSimpleName(); @Override protected void onCreate(Bundle

Android Studio Menu Item click not working

馋奶兔 提交于 2019-12-20 03:40:33
问题 So my menu items wont do anything except show the enlarging animation when clicked on. Im trying to open a new activity with them, I have toast attached to one to see if does anything at all and I'm getting nothing. Is this a common issue? minSdkVersion 17 targetSdkVersion 27 Layout <android.support.design.widget.BottomNavigationView android:id="@+id/navigation" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginEnd="0dp" android:layout_marginStart="0dp"