In Android 11 Toast.setView() is deprecated.
I wanted to now if there is a way to achieve similar results without using setView() like custom font, background color, corner radius etc.
Below you can find my current view I was using in setView().
<com.google.android.material.card.MaterialCardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:clickable="false"
android:focusable="false"
app:cardElevation="0dp"
app:cardBackgroundColor="@color/primary_dark"
android:alpha="0.9"
app:cardCornerRadius="@dimen/radius_toast">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/toast_dark_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="@dimen/height_toast"
android:gravity="center"
android:paddingVertical="@dimen/radius_toast"
android:layout_marginHorizontal="@dimen/radius_toast"
android:layout_gravity="center_vertical"
android:fontFamily="@font/playfair_display_regular"
tools:text="Custom toast text"
android:textColor="@color/primary"
android:textSize="@dimen/text_size_regular_14sp" />
</FrameLayout>
</com.google.android.material.card.MaterialCardView>