Android之旅第五站——进度条对话框dialog …
来源:互联网 发布:微纳制造技术 知乎 编辑:程序博客网 时间:2024/06/07 02:04
进度条对话框更加简单了。。
效果图:
附上代码:
Mainactivity:
package com.example.dialog1;import android.app.Activity;import android.app.ProgressDialog;import android.os.Bundle;import android.view.Menu;import android.view.MenuItem;import android.view.View;import android.widget.Button;public class MainActivity extends Activity { private Button bt; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initViews(); } private void initViews() { // TODO Auto-generated method stub bt = (Button) findViewById(R.id.bt); } public void myclick(View v) { ProgressDialog pd=new ProgressDialog(this); pd.setMax(100); pd.setSecondaryProgress(30); pd.setTitle("进度条:"); pd.setIcon(R.drawable.ic_launcher); pd.setMessage("正在下载。。。"); pd.show(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }}
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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.dialog1.MainActivity" > <Button android:id="@+id/bt" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="progress" android:onClick="myclick" /></RelativeLayout>
0 0
- Android之旅第五站——进度条对话框dialog …
- Android之旅第五站——ListView对话框dialog …
- Android之旅第五站——单选和多选对话框dialog …
- Android之旅第五站——日期对话框dialog …
- Android之旅第五站——时间对话框dialog …
- 24. android dialog ——ProgressDialog 进度条对话框详解
- android dialog ——ProgressDialog 进度条对话框详解
- android dialog ——ProgressDialog 进度条对话框详解
- android dialog ——ProgressDialog 进度条对话框详解
- android dialog ——ProgressDialog 进度条对话框详解
- Android之旅第五站——初识一般dialog …
- Dialog对话框之ProgressDialog(进度条),DatePickerDialog,Toast
- 【Android】之【对话框 Dialog】
- Android之对话框Dialog
- 【Android】对话框之进度条
- 21. android dialog——自定义对话框之二
- Android之ProgressBar ProgressDialog 进度条 进度条对话框
- 【Android】之【对话框(Dialog)大全】
- Ubuntu在命令行下将默认语言改为英语
- [LeetCode]15.3Sum
- JSON-lib框架介绍
- 学生会三年经历与体会——大学价值观树立
- vs输出框用OutputDebugString输出不了log了
- Android之旅第五站——进度条对话框dialog …
- OpenStack:glance_store:_drivers/filesystem.py文件源码学习-02
- grub2中命令的执行
- java内部类详解
- 如何恢复或重置FreeBSD & Linux的root密码
- Java线程(篇外篇):阻塞队列BlockingQueue
- leetcode_middle_15_494. Target Sum
- 正则表达式应用
- 第三方App接入微信登录 解读