Màu mặc định của thành phần Bánh mì nướng - màu xám đậm bên trong, màu viền xám nhạt và giá trị alpha là gì? Tôi đã kiểm tra lại mã nguồn của Toast.java nhưng không thể tìm thấy nó.Màu mặc định của bánh mì nướng của Android và alpha
6
A
Trả lời
15
Vì vậy, từ xml transient_notification
bố trí:
<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="@drawable/toast_frame">
<TextView
android:id="@android:id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.Small"
android:textColor="@color/bright_foreground_dark"
android:shadowColor="#BB000000"
android:shadowRadius="2.75"
/>
</LinearLayout>
nào trỏ tới res/drawable-hdpi/toast_frame.9.png
. Hình ảnh đó có vẻ khác nhau từ phiên bản này sang phiên bản khác. Bạn có thể tìm thấy chúng trong thư mục android-sdk của mình, bên trong /platforms/<the version you want>/data/res
.
0
Như tôi đã tìm thấy Mặc định Toast Màu và Alpha là như sau
Màu - đen (0, 0, 0)
Alpha - 150
ARGB - (150, 0, 0 , 0)
Bạn có thể sử dụng mã java dưới đây để thực hiện một Toast Rectangular: -
Toast_obj.getView().setBackgroundColor(Color.argb(150, 0, 0, 0));