Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Blackberry 如何在单击按钮时更改其颜色_Blackberry_Buttonfield - Fatal编程技术网

Blackberry 如何在单击按钮时更改其颜色

Blackberry 如何在单击按钮时更改其颜色,blackberry,buttonfield,Blackberry,Buttonfield,我有一个按钮字段。它的颜色是红色的。当我单击“颜色”按钮时,按钮应变为黑色。如何操作?您是否试用过本教程“”,或者您也可以将背景设置为一种颜色,并为所需的更改实施自定义绘制方法 您是否试用过本教程“”,或者您也可以将背景设置为一种颜色的位图字段,并为所需的更改实施自定义绘制方法 如果您的按钮是一个a class=“button”标记,您可以这样做: a.button { color: black; } 如果您的按钮是一个a class=“button”标记,您可以这样做: a.butt

我有一个按钮字段。它的颜色是红色的。当我单击“颜色”按钮时,按钮应变为黑色。如何操作?

您是否试用过本教程“”,或者您也可以将背景设置为一种颜色,并为所需的更改实施自定义绘制方法

您是否试用过本教程“”,或者您也可以将背景设置为一种颜色的位图字段,并为所需的更改实施自定义绘制方法

如果您的按钮是一个
a class=“button”
标记,您可以这样做:

a.button {
    color: black;
}

如果您的按钮是一个
a class=“button”
标记,您可以这样做:

a.button {
    color: black;
}
您可以尝试使用正式的RIM文档

我想这就是你想要的

你可以试试正式的RIM文档

我想这就是你想要的

用这个-

图1为红色图像按钮,图2为黑色

reg_can_btn editprofile = new reg_can_btn("", Field.FOCUSABLE |FIELD_HCENTER,  image1, image2, 0x102839);
然后

用这个-

图1为红色图像按钮,图2为黑色

reg_can_btn editprofile = new reg_can_btn("", Field.FOCUSABLE |FIELD_HCENTER,  image1, image2, 0x102839);
然后

试试这个,这是工作

  public int checkBoxFlag1 = 0;
    public int checkBoxFlag2 = 0;
    public int checkBoxFlag3 = 0;

final Bitmap focuscheckButton = Bitmap.getBitmapResource("checkbox_tickmark.png");
        final Bitmap unfocuscheckButton = Bitmap.getBitmapResource("checkbox.png");

        HorizontalFieldManager checkBoxFieldManager = new HorizontalFieldManager(); 

        BitmapField checkBox1 = new BitmapField(unfocuscheckButton,Field.FOCUSABLE)
        {
            protected void paint(Graphics graphics) 
            {
                // TODO Auto-generated method stub
                if(checkBoxFlag1==0)
                {
                    this.setBitmap(unfocuscheckButton);
                }
                else
                {
                    this.setBitmap(focuscheckButton);
                }
                super.paint(graphics);
            }
            protected boolean navigationClick(int status, int time) 
            {
                // TODO Auto-generated method stub
                if(checkBoxFlag1==0)
                {
                    checkBoxFlag1=1;
                }
                else
                {
                    checkBoxFlag1=0;
                }
                return super.navigationClick(status, time);
            }

        };      
        checkBox1.setMargin(0,20,0,20);
        checkBoxFieldManager.add(checkBox1);
试试这个,这是工作

  public int checkBoxFlag1 = 0;
    public int checkBoxFlag2 = 0;
    public int checkBoxFlag3 = 0;

final Bitmap focuscheckButton = Bitmap.getBitmapResource("checkbox_tickmark.png");
        final Bitmap unfocuscheckButton = Bitmap.getBitmapResource("checkbox.png");

        HorizontalFieldManager checkBoxFieldManager = new HorizontalFieldManager(); 

        BitmapField checkBox1 = new BitmapField(unfocuscheckButton,Field.FOCUSABLE)
        {
            protected void paint(Graphics graphics) 
            {
                // TODO Auto-generated method stub
                if(checkBoxFlag1==0)
                {
                    this.setBitmap(unfocuscheckButton);
                }
                else
                {
                    this.setBitmap(focuscheckButton);
                }
                super.paint(graphics);
            }
            protected boolean navigationClick(int status, int time) 
            {
                // TODO Auto-generated method stub
                if(checkBoxFlag1==0)
                {
                    checkBoxFlag1=1;
                }
                else
                {
                    checkBoxFlag1=0;
                }
                return super.navigationClick(status, time);
            }

        };      
        checkBox1.setMargin(0,20,0,20);
        checkBoxFieldManager.add(checkBox1);

您想更改什么,背景颜色还是文本颜色?您想更改什么,背景颜色还是文本颜色?