2011-07-25 21 views
0

別の質問から見つけたコードを使用しました。私はpositionYpositionXのためにどのような値を入れるべきか分からなかったので、setPositionChild()の部分をコメントアウトしました。私がアプリを実行すると、バックグラウンド画像が一番上に表示され、後でマネージャーに追加するボタンがすべて画像の下部に一緒に押し込まれます。バックグラウンドイメージを整列させる方法を教えてください。 (ブラックベリー)

Background bg = BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("Background.JPG")); 
    Bitmap bmp = Bitmap.getBitmapResource("Background.JPG"); 
    BitmapField imgField = new BitmapField(bmp); 
    // Create the field manager 
    VerticalFieldManager manager = new VerticalFieldManager() 
    { 
     // Overide the sublayout of the field manager to set the position of 
     // the image directly 
    /* protected void sublayout(int width, int height) 
     { 
     setPositionChild(imgField, positionX, positionY) 
     setExtent(width, height) 
     }*/ 
    }; 
    // Set the background of the field manager 
    manager.setBackground(bg); 
    // add the bitmap field to the field manager 
    manager.add(imgField); 
    // add the field manager to the screen 
    add(manager); 

答えて

0

あなたがここで達成しようとしていることを言及してください。期待される行動は何ですか?コードを見ると、appを実行するときに言及したように、子フィールドを配置する必要があります。 BitmapField(imageField)をマネージャに追加してから、おそらくボタンにコードを追加することになります(コードに他のコードを追加することを前提にしています)。それで、達成したいことの詳細を提供してください。

+0

実際、私は今あなたが意味するものを理解しています。私はimageFieldの追加を取り除き、それが私が望むように機能しました。 – Paul

関連する問題