In the new library appeared Bottom navigation view. I need to make sure that when I scroll down the list (for example, lines), he hides, and when he scrolls up the list, he appears.
Here’s how this video is https://material-design.storage.googleapis.com/publish/material_v_9/0B3321sZLoP_HNUFCLXIwV2FOcDQ/components_bottomnavigation_behavior_backtotop.webm
Here is the code:
public class MainActivity extends AppCompatActivity { ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); BottomNavigationView bottomNavigationView = (BottomNavigationView) findViewById(R.id.bottom_navigation); bottomNavigationView.isAttachedToWindow(); listView = (ListView) findViewById(android.R.id.list); String[] array = new String[20]; for(int i =0; i<20;i++) { array[i] = "item"+i; } ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, array); listView.setAdapter(adapter); } } Here is the XML code -
<?xml version="1.0" encoding="utf-8"?> <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" tools:context="com.kerjen.exodus.learning_1.MainActivity"> <ListView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@android:id/list"/> <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:itemBackground="@color/colorBNV" app:itemIconTint="@color/colorTextBNV" app:itemTextColor="@color/colorTextBNV" app:menu="@menu/menu_bottom_navigation" />