我试图显示进度对话框并得到它,但现在想知道如何为进度对话框设置背景颜色,并且必须为进度条设置颜色。任何帮助赞赏我的代码
public class MainActivity extends Activity {
ProgressDialog progress;
Button b;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
b=(Button)findViewById(R.id.button1);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
progress= new ProgressDialog(MainActivity.this);
progress.setMessage("Loading...!");
progress.show();
}
});
}}
XML 代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="164dp"
android:text="Start"/>