自定义Dialog:显示SeekBar

效果图:

步骤:

//SettingActivity.java
button4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
sensorDialog = new SensorDialog(SettingActivity.this); //调用Dialog
sensorDialog.show();
}
});
//SensorDialog.java
public class SensorDialog extends Dialog {
private SeekBar mSeekBar;
private TextView mProgressText; protected SensorDialog(Context context) {
super(context);
} @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.sensorprogress); mSeekBar = (SeekBar) findViewById(R.id.seek); //取得SeekBar对象
mProgressText = (TextView) findViewById(R.id.progress); mSeekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar arg0) {
}
@Override
public void onStartTrackingTouch(SeekBar arg0) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
mProgressText.setText("当前值:"+ Config.PROGRESS);
}
});
}
}
//sensorprogress.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"> <SeekBar
android:id="@+id/seek"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:max="100" android:progress="50"
android:secondaryProgress="75" /> <TextView android:id="@+id/progress"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="当前值:50" android:textSize="30sp" />
</LinearLayout>

参考链接:http://www.apkbus.com/forum.php?mod=viewthread&tid=13854

示例代码下载:

Android:自定义Dialog的更多相关文章

  1. Android自定义 Dialog 对话框

    Android自定义Dialoghttp://www.cnblogs.com/and_he/archive/2011/09/16/2178716.html Android使用自定义AlertDialo ...

  2. Android—自定义Dialog

    在 Android 日常的开发中,Dialog 使用是比较广泛的.无论是提示一个提示语,还是确认信息,还是有一定交互的(弹出验证码,输入账号密码登录等等)对话框. 而我们去看一下原生的对话框,虽然随着 ...

  3. Android自定义Dialog(美化界面)

    前言:在做项目的时候,发现dialog界面太丑陋,从csdn上下载了一份自定义dialog的源码,在他的基础上对界面进行美化...有需要的朋友可以直接拿走 效果图如下: 主要代码: /** * 自定义 ...

  4. Android自定义Dialog及其布局

     实际项目开发中默认的Dialog样式无法满足需求,需要自定义Dialog及其布局,并响应布局中控件的事件. 上效果图: 自定义Dialog,LogoutDialog: 要将自定义布局传入构造函数中, ...

  5. android 自定义Dialog背景透明及显示位置设置

    先贴一下显示效果图,仅作参考: 代码如下: 1.自定义Dialog public class SelectDialog extends AlertDialog{ public SelectDialog ...

  6. Android自定义Dialog

    Android开发过程中,常常会遇到一些需求场景——在界面上弹出一个弹框,对用户进行提醒并让用户进行某些选择性的操作, 如退出登录时的弹窗,让用户选择“退出”还是“取消”等操作. Android系统提 ...

  7. android 自定义Dialog去除黑色边框

    在自定义Dialog时显示的界面中老是有黑色的边框,下面就介绍使用style去除黑色边框方法. 首先在values/styles定义自定义样式: <style name="MyDial ...

  8. Android 自定义Dialog类,并在Activity中实现按钮监听。

      实际开发中,经常会用到Dialog,比如退出时候会弹出是否退出,或者还有一些编辑框也会用Dialog实现,效果图如下: 开发中遇到的问题无非在于如果在Activity中监听这个Dialog中实现的 ...

  9. Android 自定义Dialog 去除阴影

    自定义Dialog中添加下列代码: window.clearFlags( WindowManager.LayoutParams.FLAG_DIM_BEHIND);

  10. android自定义dialog布局

    dialog使用系统自带的有时候不是很美观,就想要自己来设计一个dialog界面,以下就是可以设计的dialog界面: public class CustomDialog extends Dialog ...

随机推荐

  1. react实现删除输入框内容

    react中实现删除输入框中的内容 import React,{Component} from 'react' class Clear extends Component{ constructor(p ...

  2. 2018年湘潭大学程序设计竞赛 H统计颜色

    链接:https://www.nowcoder.com/acm/contest/105/H来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536 ...

  3. springboot集成druid连接池

    使用druid连接池主要有几步: 1.添加jar和依赖 <groupId>org.mybatis.spring.boot</groupId> <artifactId> ...

  4. 获取CPU序列号、网卡MAC地址、硬盘序列号

    <pre name="code" class="csharp"> using System; using System.Collections; u ...

  5. GO语言的进阶之路-Golang高级数据结构定义

    GO语言的进阶之路-Golang高级数据结构定义 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 我们之前学习过Golang的基本数据类型,字符串和byte,以及rune也有所了解, ...

  6. xen 配置vm 跟随xen server一起启动

    查看Xen Server 信息 (1)查看pool信息 [root@xenserver-243 ~]# xe pool-list uuid ( RO) : e29037aa-0dca-f95a-193 ...

  7. Openresty+redis实现灰度发布

    一.架构 环境: 192.168.189.131:tomcat服务 192.168.189.132:tomcat服务 192.168.189.130:OpenResty服务.redis服务 流程: 请 ...

  8. JavaScript中的栈和堆内存,作用域

    1.栈 stack”和“堆 heap”            简单的来讲,stack上分配的内存系统自动释放,heap上分配的内存,系统不释放,哪怕程序退出,那一块内存还是在那里.stack一般是静态 ...

  9. Hive记录-加载文件进行查询操作

    Hive可以运行保存在文件里面的一条或多条的语句,只要用-f参数,一般情况下, 保存这些Hive查询语句的文件通常用.q或者.hql后缀名,但是这不是必须的, 你也可以保存你想要的后缀名.假设test ...

  10. Quartz.net创建windows服务

    序言 安装服务 sc create XXService binpath= "XXService.exe" start= auto sc description XXService ...