0

The classic Snackbar provided from Android design library works in wear project. In square display they looks fine, but in round they don't. The corner of the snackbar are cropped by the circular display. Does anyone know a workaround? I don't want to use toast.

see the image:

enter image description here

the code that I use:

Snackbar.make(view, serverMessage, Snackbar.LENGTH_SHORT).show();

Thanks

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56
alex_au
  • 240
  • 1
  • 2
  • 11

1 Answers1

1

According to the Android blog, there are several ways you can do this. These are :

  1. Using BoxInsertLayout which is mentioned in the Use a Shape-Aware Layout guide.

enter image description here

The BoxInsetLayout class included in the Wearable UI Library extends FrameLayout and lets you define a single layout that works for both square and round screens. This class applies the required window insets depending on the screen shape and lets you easily align views on the center or near the edges of the screen.

  1. WatchViewStub


    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/watch_view_stub"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:rectLayout="@layout/rect_activity_main"
    app:roundLayout="@layout/round_activity_main"
    tools:context="com.android.example.watchviewstub.MainActivity"
    tools:deviceIds="wear">

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56