Android KitKat get Toast radius?
-
21-12-2019 - |
Question
Im using the library by RomainNurik to show an Undo-Toast to the user (like in the Gmail app)
Prior to KitKat the toast option was rectangular, and in KitKat there toast message has rounded corners. Is there a get() method to get the Radius of the Toast? So that if im using the library,I can getRadius() ,and adjust my toast according to that?
Note: Otherwise I would have to specify two differnt values, one prior to KitKat and one for KitKat.
Solution
Maybe what you want is android:shadowRadius
of the Toast which is 2.75
in the layout file.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="?android:attr/toastFrameBackground">
<TextView
android:id="@android:id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_horizontal"
android:textAppearance="@style/TextAppearance.Toast"
android:textColor="@color/bright_foreground_dark"
android:shadowColor="#BB000000"
android:shadowRadius="2.75"
/>
</LinearLayout>
I found it in Android SDK\sdk\platforms\android-19\data\res\layout
named transient_notification.xml
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow