2011-11-24 70 views

回答

15

于是从transient_notification布局XML:

<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> 

它指向res/drawable-hdpi/toast_frame.9.png。尽管如此,该图像似乎因版本而异。您可以在/platforms/<the version you want>/data/res的android-sdk文件夹中找到这些文件。

0

正如我发现默认吐司颜色和alpha是如下

颜色 - 黑色(0,0,0)

阿尔法 - 150

ARGB - (150,0,0 ,0)

您可以使用下面的Java代码来敬酒矩形: -

Toast_obj.getView().setBackgroundColor(Color.argb(150, 0, 0, 0));