excel表格如何拉长
545
2022-05-30
[Android开发视频教学].01_13_Android常见控件(三)之一
学习使用ProgressBar
style="?android:attr/progressBarStyleHorizontal"
style="@android:style/Widget.ProgressBar.Horizontal"
package fengda.android08; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ProgressBar; public class Activity08 extends Activity { private ProgressBar progressBar1; private ProgressBar progressBar2; private Button button; private int i =0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_activity08); progressBar1 = (ProgressBar) findViewById(R.id.progressBar1); progressBar2 = (ProgressBar) findViewById(R.id.progressBar2); button = (Button) findViewById(R.id.button);; button.setOnClickListener( new ButtonOnClickListener()); } class ButtonOnClickListener implements OnClickListener { @Override public void onClick(View v) { // TODO Auto-generated method stub if (i==0){ progressBar1.setVisibility(View.VISIBLE); progressBar2.setVisibility(View.VISIBLE); } else if(i<100){ progressBar1.setProgress(i); progressBar2.setProgress(i); progressBar2.setSecondaryProgress(i+10); } else { progressBar1.setVisibility(View.GONE); progressBar2.setVisibility(View.GONE); } i = i+10; } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_activity08, menu); return true; } }
Android
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。