【发布时间】:2012-04-26 23:01:03
【问题描述】:
我想要设置它,让进度条加载 15 秒,然后继续下一个活动。
现在活动有:
public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn5 =(Button)findViewById(R.id.button);
btn5.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent myIntent = new Intent();
myIntent.setAction(Intent.ACTION_VIEW);
myIntent.setData(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
setContentView(R.layout.loading);
}
});
}
}
而xml页面有:
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="144dp"
android:layout_gravity="center_vertical" />
我想知道如何让progressBar1加载15秒然后转到result.xml
【问题讨论】:
-
查看 StackOverflow 上的所有“启动画面”问答,因为这在行为方面是相同的。最快的选择可能是在
Handler上发布Runnable,延迟15 秒,然后开始您的第三个Activity。 -
您可以创建一个单独的线程来处理进度条,在线程中提供所需的延迟,然后关闭进度条...
标签: android xml loading android-progressbar