带有白色背景的BlackBerry AutoComplete字段?

时间:2010-07-23 10:24:17

标签: user-interface blackberry background

我在更改AutoCompleteField的背景时遇到问题。无论我尝试什么,背景都是灰色的(不是很奇怪,首先它是灰色的......)。

任何人都知道如何使背景变白(例如在BlackBerry电子邮件客户端中)?

提前致谢!

1 个答案:

答案 0 :(得分:0)

BB方式是在您想要更改其样式(例如颜色)时扩展现有字段,因此这是我的解决方案:

screenshot

MyAuto.java:

package mypackage;

import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.decor.*;
import net.rim.device.api.system.*;
import net.rim.device.api.collection.util.*;

public class MyAuto extends UiApplication {
    public static void main(String[] args) {
        MyAuto myAuto = new MyAuto();
        myAuto.enterEventDispatcher();
    }

    public MyAuto () {
        pushScreen(new MyScreen());
    }    
}

class MyScreen extends MainScreen {
    public MyScreen() {
        BasicFilteredList filterList = new BasicFilteredList();
        String[] days = {"Monday","Tuesday","Wednesday",
                        "Thursday","Friday","Saturday","Sunday"};
        filterList.addDataSet(1,days,"days",BasicFilteredList.COMPARISON_IGNORE_CASE);
        Background myBG = BackgroundFactory.createSolidBackground(Color.YELLOW);
        Border myBorder = BorderFactory.createBitmapBorder( 
            new XYEdges( 20, 16, 27, 23 ), 
            Bitmap.getBitmapResource( "bubble_left.png" ) );
        AutoCompleteField autoCompleteField = new AutoCompleteField(filterList);
        autoCompleteField.setBorder(myBorder);
        autoCompleteField.getEditField().setBackground(myBG);
        add(autoCompleteField);
    }
}

bubble_left.png并不是真的需要,我为了好玩而添加了它:

enter image description here

BTW在我的模拟器(BB 9800)中,背景默认为白色。