ユーザーが http 接続を要求したときにロード画面を表示したい.stackoverflow と google からいくつかの良いサンプルを取得しましたが、それらはすべて別の画面を使用してロード画面を表示します.ユーザーが要求したのと同じ画面に表示したい. http 接続。アイデアがある場合は、私に共有してください。よろしくお願いします。
2 に答える
1
私は通常、メイン画面のステータスセクションでGaugeFieldを使用します。setStatus(Field field)メソッドを使用して設定します。
于 2011-03-12T15:52:44.487 に答える
0
OS v6.0 向けに開発している場合、RIM は進行状況を示すための API を提供しています http://docs.blackberry.com/en/developers/deliverables/17971/Indicate_activity_1210002_11.jsp
以下の OS v6.0 では、下のコードが ProgressAnimationField に役立つ可能性があります。これは、ビットマップ スピナー/ローダー イメージ、その num フレーム、およびスタイルを取得するカスタム フィールドです。
import net.rim.device.api.system.*;
import net.rim.device.api.ui.*;
/**
* Custom class for spinner animation
*/
public class ProgressAnimationField extends Field implements Runnable
{
private Bitmap _bitmap;
private int _numFrames;
private int _frameWidth;
private int _frameHeight;
private int _currentFrame;
private int _timerID = -1;
private Application _application;
private boolean _visible;
public ProgressAnimationField( Bitmap bitmap, int numFrames, long style )
{
super( style | Field.NON_FOCUSABLE );
_bitmap = bitmap;
_numFrames = numFrames;
_frameWidth = _bitmap.getWidth() / _numFrames;
_frameHeight = _bitmap.getHeight();
_application = Application.getApplication();
}
public void run()
{
if( _visible ) {
invalidate();
}
}
protected void layout( int width, int height )
{
setExtent( _frameWidth, _frameHeight );
}
protected void paint( Graphics g )
{
g.drawBitmap( 0, 0, _frameWidth, _frameHeight, _bitmap, _frameWidth * _currentFrame, 0 );
_currentFrame++;
if( _currentFrame >= _numFrames ) {
_currentFrame = 0;
}
}
protected void onDisplay()
{
super.onDisplay();
_visible = true;
if( _timerID == -1 ) {
_timerID = _application.invokeLater( this, 200, true );
}
}
protected void onUndisplay()
{
super.onUndisplay();
_visible = false;
if( _timerID != -1 ) {
_application.cancelInvokeLater( _timerID );
_timerID = -1;
}
}
}
于 2011-03-13T07:21:44.337 に答える