-1

i want to warp views in android ,

for example need to create wave on top of screen and any time can convert it to straight line

or

use a button in bottom navigation bar which create a wave on bottom navigation

please visit screenshots:

screenshot 1

screenshot 2

screenshot 3

Bahadori
  • 99
  • 2
  • 12

1 Answers1

0

This is new Design as per material IO. It is introduced in material design 2. You need to add anchor for using that type of view.

There are some changes which need to be noted.

  • This is AppBar which is placed at bottom not BottomNavigatioView.
  • It can be used for multi-purpose, so chose your use wisely.
  • You can modify design as your need.

Following code can be used to achieve that functionality.

<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <!-- Other components and views -->

  <com.google.android.material.bottomappbar.BottomAppBar
      android:id="@+id/bar"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom"
      app:navigationIcon="@drawable/ic_menu_24"/>

  <com.google.android.material.floatingactionbutton.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      app:layout_anchor="@id/bar"/>

</android.support.design.widget.CoordinatorLayout>

The FloatingActionButton can be anchored to the BottomAppBar by setting app:layout_anchor or by calling CoordinatorLayout.LayoutParams#setAnchorId(int).

Note: This things are introduced in Android P versions, you need to have Android studio 3.2 or above.

Checkout this link for detailed explanation :

Implementing BottomAppBar: Material Components for Android

Pragnesh Ghoda シ
  • 8,098
  • 3
  • 23
  • 39