【问题标题】:Android KitKat get Toast radius?Android KitKat 获得 Toast 半径?
【发布时间】:2014-04-13 09:14:01
【问题描述】:
我正在使用 RomainNurik 的库向用户显示 Undo-Toast(就像在 Gmail 应用中一样)
在 KitKat 之前,吐司选项是矩形的,而在 KitKat 中,吐司消息具有圆角。
是否有获取吐司半径的 get() 方法?这样,如果我使用该库,我可以 getRadius() 并据此调整我的吐司?
注意:否则我将不得不指定两个不同的值,一个在 KitKat 之前,一个在 KitKat 之前。
【问题讨论】:
标签:
android
android-toast
【解决方案1】:
也许你想要的是布局文件中的2.75 Toast 的android:shadowRadius。
<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>
我在 Android SDK\sdk\platforms\android-19\data\res\layout 中找到了它,名为 transient_notification.xml