自定义AlertDialog.Builder
来源:互联网 发布:mac dare you和diva 编辑:程序博客网 时间:2024/06/14 10:08
AlertDialog.Builder builder = new Builder(MainActivity.this);
zdy = builder.create();
View view1 = View.inflate(getApplicationContext(), R.layout.jikao, null);
zdy.setView(view1);
bar = (ProgressBar) view1.findViewById(R.id.jdt);
textView = (TextView) view1.findViewById(R.id.sz);
zdy.show();
//消失
zdy.dismiss();
//AlertDialog视图
<ProgressBar
android:id="@+id/jdt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
style="@android:style/Widget.ProgressBar.Horizontal"
android:progress="0"
/>
<TextView
android:id="@+id/sz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0%"
android:textSize="20sp"
//定义AlertDialog的宽高
android:id="@+id/jdt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
style="@android:style/Widget.ProgressBar.Horizontal"
android:progress="0"
/>
<TextView
android:id="@+id/sz"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="0%"
android:textSize="20sp"
//定义AlertDialog的宽高
- AlertDialog dialog = builder.create();
- dialog.setView(view);
- dialog.show();
- WindowManager m = getWindowManager();
- Display d = m.getDefaultDisplay(); //为获取屏幕宽、高
- android.view.WindowManager.LayoutParams p = dialog.getWindow().getAttributes(); //获取对话框当前的参数值
- p.height = (int) (d.getHeight() * 0.3); //高度设置为屏幕的0.3
- p.width = (int) (d.getWidth() * 0.5); //宽度设置为屏幕的0.5
- dialog.getWindow().setAttributes(p); //设置生效
0 0
- 自定义AlertDialog.Builder
- 使用AlertDialog.Builder自定义对话框
- 关于AlertDialog.Builder的自定义
- AlertDialog.Builder+SpannableStringBuilder自定义单选框
- AlertDialog.Builder弹出自定义Layout窗口
- AlertDialog.Builder弹出自定义Layout窗口
- AlertDialog.Builder弹出自定义Layout窗口
- AlertDialog.Builder
- AlertDialog.Builder
- AlertDialog.Builder
- AlertDialog.Builder
- AlertDialog.Builder
- AlertDialog和AlertDialog.Builder
- Android详细的对话框AlertDialog.Builder使用方法和自定义样式
- Android之自定义对话框AlertDialog.Builder+getLayoutInflater().inflate
- 重访AlertDialog和AlertDialog.Builder
- [android]AlertDialog和AlertDialog.Builder
- android中的AlertDialog.Builder
- 菜鸟网络工程师的成长笔记——第8天(2016.08.25)
- 小菜学习日记—div嵌套导致子区域margin-top失效问题(外边距合并问题)
- 文章标题
- TCP Linux socket编程实现两个正整数的加法
- 弱口令扫描
- 自定义AlertDialog.Builder
- 面试1~3剑指offer
- URL的常用方法
- servlet入门介绍
- python爬虫入门-urllib的基本用法
- BeanUtils的copyProperties,populate实现方式分析以及容易引发的Bug
- 初学java
- mysql 查询结果 导出 excel格式并解决乱码问题
- IntelliJ IDEA导出Java 可执行Jar包