![](/img/trans.png)
[英]Change text color and background color of textview using color picker in android
[英]Color Picker how to change TextView
我有個問題。 如何使用ColorPickerDialog? 如何設置ColorPickerDialog以更改文本顏色?
您可以使用此項目代替演示應用程序
// initialColor is the initially-selected color to be shown in the rectangle on the left of the arrow.
// for example, 0xff000000 is black, 0xff0000ff is blue. Please be aware of the initial 0xff which is the alpha.
AmbilWarnaDialog dialog = new AmbilWarnaDialog(this, initialColor, new OnAmbilWarnaListener() {
@Override
public void onOk(AmbilWarnaDialog dialog, int color) {
// color is the color selected by the user.
}
@Override
public void onCancel(AmbilWarnaDialog dialog) {
// cancel was selected by the user
}
});
dialog.show();
請注意這一點(我自己從未使用過):
您需要針對Android 3.0或更高版本進行鏈接,因為正在使用XML屬性layerType。 這並不意味着您只能將其用於需要Android 3.0才能運行的應用程序。 即使在Android 1.6中也可以使用。 您只需要在項目設置上選擇Android 3.0(API級別11)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.