Update View at runtime in Android

前端 未结 3 1182
傲寒
傲寒 2021-01-13 08:53

The example is pretty straightforward: i want to let the user know about what the app is doing by just showing a text (canvas.drawText()). Then, my first message appears, bu

3条回答
  •  一个人的身影
    2021-01-13 09:37

    i suppose that your view is an extended view and you call onDraw for drawing the view, so, maybe the view isn´t 'refresh' their state, so try this

    onCreate(Bundle bundle) {
        setContentView(splash); // splash is the view class
    
        loadResources();
        splash.setText("this");
        splash.invalidate();
        boundWebService();
        splash.setText("that"):
        splash.invalidate();
        etc();
        splash.setText("so on");
        splash.invalidate();
    }
    

提交回复
热议问题