0
정적으로 말하자면, 최대 값이 100 일 수있는 데이터가 20 개 있습니다. 진행률을 지정하고 싶습니다. 그런 다음 진행 탭을 열면 호출 될 활동이 필요합니다. 진도를로드하고 100에서 20에 도달하면 멈 춥니 다.안드로이드에서 정적 진행 표시 줄 만들기
마침내 보일 것입니다.
Progress.
++++----------------
Progress1.
+++++++++++---------
Progress3.
+++++++-------------
내가 봤와
정확히 내 요구 사항을 알려줍니다이 지프를 얻었다. 나는 시도하고 얻을 수있는 무엇
GIF
은 다음과 같습니다
활동
public class test extends Activity {
private ProgressBar progressBar;
private int progressStatus = 0, CurrValue=20;
private TextView textView;
private Handler handler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loop);
progressBar = (ProgressBar) findViewById(R.id.progressBar1);
textView = (TextView) findViewById(R.id.textView1);
progressBar.setScaleY(3f);
// Start long running operation in a background thread
Progress();
}
public void Progress(){
new Thread(new Runnable() {
public void run() {
while (progressStatus < CurrValue) {
progressStatus += 1;
// Update the progress bar and display the
//current value in the text view
handler.post(new Runnable() {
public void run() {
progressBar.setProgress(progressStatus);
textView.setText(progressStatus+"/"+progressBar.getMax());
}
});
try {
// Sleep for 200 milliseconds.
//Just to display the progress slowly
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
}
레이아웃
그것에는 내가 보여주고 싶은 텍스트 뷰 및 ProgressBar를
애니메이션이있는 여러 개의 진행률 표시 줄 위의 GIF 링크를 클릭하십시오.
내가 해냈어. 그리고 그 일. : D 고마워! – impossible
@ArewegoodQ 멋진, 훌륭한 직장! – iheanyi