There is a class GamePanel, in which the whole game process takes place. The game is associated with the management of the spacecraft, which has ODA. margin of safety, and I would like to visualize the strength and its reduction through progressBar

RelativeLayout layout = new RelativeLayout(context); progressBar = new ProgressBar(context); progressBar.setProgress(100); layout.addView(progressBar); 

Closed due to the fact that the essence of the question is incomprehensible by the participants Yuriy SPb ♦ , aleksandr barakin , cheops , Streletz , Grundy 27 May '16 at 11:47 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Your question without significant details, the problem is not clear and you, most likely, nothing intelligible can be answered. - Yuriy SPb ♦

1 answer 1

Well, no problem, do:

 ProgressBar pb = new ProgressBar(context); pb.setProgress(intWithShipDurability); someContainerView.addView(pb); 
  • did as you wrote, added the whole thing to the constructor, but nothing appeared ( - En1q0d
  • 2
    @ En1q0d, unfortunately, even though I managed to calculate the IP of your computer, the firewall did not give me access to the hard disk and I could not look at your code to understand where and what you did wrong. - Yuriy SPb ♦
  • added what I wrote to the question) - En1q0d
  • @ En1q0d, your RelativeLayout is not added to the screen. Add widgets to what is already on the screen. Those. look at the activation markup, find the container using the findViewById method and add it to it - Yuriy SPb ♦
  • one
    @ En1q0d For the future - next time it's in question and write that you are using SurfaceView, etc., because no one here is eager to pull information from you - Android Android