2011-10-29 11 views
1

私はいくつかの行を含むリストフィールドを持っています。 ブラックベリートーチで使用しているときにうまくいきます(リストフィールドをスクロールして任意の行を選択(クリック)できます)。 しかし、私がブラックベリーストーム9500を使用しているときと同じアプリケーションでは、スクロールしようとしている間にスクロールできないので、行が選択(クリック)されているので、それが起こっている理由やlistfield嵐の中でブラックベリーの嵐とトーチのリストフィールド

マイlisfieldクラスは

import net.rim.device.api.system.Bitmap; 
import net.rim.device.api.system.Display; 
import net.rim.device.api.ui.Color; 
import net.rim.device.api.ui.Graphics; 
import net.rim.device.api.ui.UiApplication; 
import net.rim.device.api.ui.XYRect; 
import net.rim.device.api.ui.component.Dialog; 
import net.rim.device.api.ui.component.ListField; 
import net.rim.device.api.ui.component.ListFieldCallback; 

    public class SpeakersList implements ListFieldCallback 
{ 
    private String[] products; 
    private int rgb=Color.BLACK; 
    Bitmap arraow; 
    Bitmap placeholder; 
    Bitmap holder[]; 
    int i=0; 
    ImageLoad load; 
    public Bitmap _bmap; 
    ListField listField; 
    TaskWorker taskWorker; 
public SpeakersList(String[] products) 
{ 
    this.products=products; 
    arraow= Bitmap.getBitmapResource("arrow.png"); 
    DynamicImages images=new DynamicImages(); 
    placeholder=Bitmap.getBitmapResource(images.defaultimage); 
    holder=new Bitmap[QandAScreen.imglist.length]; 
    taskWorker = new TaskWorker(); 
    taskWorker.addTask(new ImageDowload()); 
} 

public void drawListRow(ListField listField, Graphics graphics, int index, 
     int y, int width) 
{ 
    this.listField=listField; 
    final String text=(String) get(listField, index); 
    if (graphics.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)) 
    { 
    if(holder[index]==null) 
    { 
    holder[index]=placeholder; 
    } 
    graphics.setColor(0xC0C0C0); 
    graphics.fillRect(0,y+0,480,59); 
    graphics.setColor(rgb); 
    graphics.setFont(Utility.getBigFont(15)); 
    graphics.drawBitmap(3,y+7,placeholder.getWidth(), placeholder.getHeight(),holder[index], 0, 0); 
    graphics.drawText(text,70,y+20); 
    if(Display.getWidth()==480){ 
    graphics.drawBitmap(460,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0); 
    } 
    else if(Display.getWidth()==360) 
    { 
     graphics.drawBitmap(330,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0); 
    } 
    else 
    { 
    graphics.drawBitmap(300,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0); 
    } 
    graphics.drawLine(0, y+59, Display.getWidth(), y+59); 
    } 
    else 
    { 
     if(holder[index]==null) 
     { 
     holder[index]=placeholder; 
     } 
     graphics.setColor(rgb); 
     graphics.setFont(Utility.getBigFont(15)); 
     graphics.drawBitmap(3,y+7,placeholder.getWidth(), placeholder.getHeight(),holder[index], 0, 0); 
     graphics.drawText(text,70,y+20); 
     if(Display.getWidth()==480){ 
      graphics.drawBitmap(460,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0); 
      } 
     else if(Display.getWidth()==360) 
     { 
      graphics.drawBitmap(330,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0); 
     } 
      else 
      { 
      graphics.drawBitmap(300,y+20,arraow.getWidth(), arraow.getHeight(),arraow, 0, 0); 
      } 
     graphics.drawLine(0, y+59, Display.getWidth(), y+59); 
    } 
} 
public Object get(ListField listField, int index) 
{ 
    return products[index]; 
} 

public int getPreferredWidth(ListField listField) 
{ 
    return Display.getWidth()+10; 
} 
public int indexOfList(ListField listField, String prefix, int start) 
{ 
    return -1; 
} 

class ImageDowload extends Task 
{ 
    void doTask() 
    { 


    for(;i<QandAScreen.imglist.length;i++) 
    { 
     String imgpath=QandAScreen.imglist[i]; 
     if(imgpath==null || imgpath.length()==0) 
     { 
      continue; 
     } 
     load=new ImageLoad(QandAScreen.imglist[i]+Const.getExtra()); 
     if(load.getData()!=null) 
     { 
      UiApplication.getUiApplication().invokeLater(new Runnable() 
      { 
       public void run() 
       { 

        _bmap=load.getBitmap(40,40); 
        listField.invalidate(i-1); 
        holder[i-1]=_bmap; 


       } 
      }); 



     } 
    } 

    } 
} 
} 

答えて

3

あなたはシミュレータや実​​際のデバイスでテストされていますか?あなたの

に感謝しますか私の記憶が役立つなら、9500 StormはSureClickディスプレイを使用します。ディスプレイには実際に小さなマイクロスイッチがありますので、タッチとクリック(ディスプレイを押す)を別々の動作として検出できます。シミュレータでは、マウスの右ボタンを使用してタッチをシミュレートする必要があり、クリックをシミュレートするために左に移動する必要があります(まったく逆でしたか?)。 Torch(9800)はSureClick-thingamabobを持っていないので、リストは左右のマウスボタンの両方でスクロールすることができます(ただし、いくつかの区別がありますが、他のものはタッチとして動作し、スクリーンなど)。

+0

すぐにお返事ありがとうございます。シミュレータのテスト9550 – kehnar

+0

もう一度ありがとうございます。私は右のマウスボタンをスクロールするときに働いています。 – kehnar

関連する問題