0
我想創建一個自定義位圖字段用於將圖標放在我的菜單屏幕上。我希望他們被點擊。我也想給圖標的X和Y座標作爲參數給Custom BitmapField。我怎樣才能做到這一點?黑莓可點擊位圖字段
我想創建一個自定義位圖字段用於將圖標放在我的菜單屏幕上。我希望他們被點擊。我也想給圖標的X和Y座標作爲參數給Custom BitmapField。我怎樣才能做到這一點?黑莓可點擊位圖字段
public class CustomMenuButtonField extends Field{
Bitmap normal,focused;
public CustomMenuButtonField(String bitmap1, String bitmap2) {
normal = Bitmap.getBitmapResource(bitmap1);
focused = Bitmap.getBitmapResource(bitmap2);
}
protected void layout(int width, int height) {
setExtent(width, height); // Set them according to your design
}
protected boolean navigationClick(int status, int time)
{
fieldChangeNotify(0);
return true;
}
public boolean isFocusable() {
return true;
}
protected void paint(Graphics graphics) {
if(isFocus())
{
graphics.drawBitmap(0, 0, width, height, focused, 0, 0);
}
else
{
graphics.drawBitmap(0, 0, width, height, normal, 0, 0);
}
}
}
如果你想給座標參數,添加它們。高度和寬度取決於你..