Android 自定义Progress Bar
2010-07-01 14:45:00 来源:WEB开发网android:layout_margin="5dip" />
< ProgressBar android:layout_width="fill_parent"
android:layout_height="wrap_content" style="?android:attr/progressBarStyleHorizontal"
android:id="@+id/progressbar_Horizontal" android:max="100"
android:layout_toRightOf="@id/progressbar_default"
android:layout_margin="5dip" />
< TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/progressbar_text"
android:layout_toRightOf="@id/progressbar_default" android:paddingTop="25dip"
android:layout_margin="5dip" android:text="init text"/>
< /RelativeLayout>
Java代码
public class ClearProgressDialog extends AlertDialog implements
DialogInterface.OnClickListener {
private ProgressBar progressBar;
private int progress = 0;
protected ClearProgressDialog(Context context) {
super(context);
init();
}
public ClearProgressDialog(Context context, boolean cancelable,
OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
init();
}
public ClearProgressDialog(Context context, int theme) {
super(context, theme);
init();
}
public void init() {
View view = getLayoutInflater().inflate(R.layout.progresslayout,
null);
progressBar = (ProgressBar) view.findViewById(R.id.progressbar_Horizontal);
setButton(getContext().getText(R.string.stop), this);
setIcon(R.drawable.andclear);
setTitle(R.string.clear_progress);
setView(view);
//progressBar = (ProgressBar) findViewById(R.id.progressbar_Horizontal);
}
public void onClick(DialogInterface dialog, int which) {
}
Handler pHandle = new Handler() {
public void handleMessage(Message msg) {
}
};
public void setProgress(int per, String str) {
}
public void stop() {
}
}
更多精彩
赞助商链接