原seek_thumb样式----------------------------------------------------------------------↑↑↑↑↑

android:thumb="@drawable/my_thumb"
 
改写my_thumb.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:state_window_focused="true"
android:drawable="@drawable/select"/> <item android:state_focused="true"
android:state_window_focused="true"
android:drawable="@drawable/select"/> <item android:state_selected="true"
android:state_window_focused="true"
android:drawable="@drawable/select"/> <item android:drawable="@drawable/normal"/>
</selector>

  

Acitivity.class

public class MainActivity extends AppCompatActivity implements SeekBar.OnSeekBarChangeListener{
private SeekBar seekBar;
private TextView text1;
private TextView text2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
seekBar = (SeekBar) findViewById(R.id.seekbar);
seekBar.setOnSeekBarChangeListener(this);
text1 = (TextView) findViewById(R.id.txt1);
text2 = (TextView) findViewById(R.id.txt2); } //数值改变
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
text1.setText("正在拖动");
text2.setText("当前数值"+ progress);
} //开始拖动
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
text1.setText("开始拖动"); } //停止拖动
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
text1.setText("停止拖动");
}

  

Acitivity.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"> <SeekBar
android:thumb="@drawable/my_thumb"
android:id="@+id/seekbar"
android:max="100"
android:progress="50"
android:layout_width="match_parent"
android:layout_height="wrap_content" /> <TextView
android:layout_below="@id/seekbar"
android:id="@+id/txt1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_below="@id/txt1"
android:id="@+id/txt2"
android:layout_width="match_parent"
android:layout_height="wrap_content" /> </RelativeLayout>

  

SeekBar 滚动条的更多相关文章

  1. Android_SeekBar

    xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too ...

  2. android 滑动滚动条调节音量

    利用滚动条滑动控制音量: 定义: private SeekBar mseekBarvolume: 以下实现代码: //调节音量--begin------------------------- //音量 ...

  3. Android SeekBar 和 draw9patch 的使用

    今天要使用一个SeekBar控件,其实我觉得Android默认样式已经很不错了,无奈设计不同意,而且SeekBar左右两边也有图片,默认样式和图片也确实不协调,因此这里使用图片自定义SeekBar样式 ...

  4. Android开发 SeekBar开发记录

    前言 开发记录博客不是讲解使用博客,更多的是各种功能与点子的记录 基本使用 <SeekBar android:layout_width="match_parent" andr ...

  5. JavaScript自定义浏览器滚动条兼容IE、 火狐和chrome

    今天为大家分享一下我自己制作的浏览器滚动条,我们知道用css来自定义滚动条也是挺好的方式,css虽然能够改变chrome浏览器的滚动条样式可以自定义,css也能够改变IE浏览器滚动条的颜色.但是css ...

  6. CSS3自定义滚动条样式 -webkit-scrollbar(转)

    有没有觉得浏览器自带的原始滚动条很不美观,同时也有看到很多网站的自定义滚动条显得高端,就连chrome32.0开发板都抛弃了原始的滚动条,美观多了.那webkit浏览器是如何自定义滚动条的呢? 前言 ...

  7. div中设置滚动条的问题

    <div srtle="width:100px;height:50px;"></div> 这样的一个div,当文本超出的时候我们就会设: overflow: ...

  8. 高分辨率下IE浏览器缩放导致出现右侧滚动条问题的解决

    0 问题描述 由于需要演示触控操作,采购了SurfacePro,SurfacePro的推荐分辨率为2736×1824,且默认缩放比例为200%,IE浏览器的默认缩放比例也是200%,这样就导致右侧出现 ...

  9. [C1] 分离 C1FlexGrid 滚动条

    一  场景介绍 Silverlight 5.0 的 C1FlexGrid 控件里自带的滚动条,是嵌入在 C1FlexGrid 宽度和高度的范围里的,效果如下图所示: (未隐藏自带滚动条) (隐藏自带的 ...

随机推荐

  1. React Native中Touchable组件的使用

    截图如下: /** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import Rea ...

  2. SpringBoot: 2.SpringBoot整合servlet(转)

    整合方式1:通过注解扫描完成 Servlet 组件的注册 1.编写servlet package com.bjsxt.servlet; import javax.servlet.ServletExce ...

  3. 《基于TCP交换的电路交换与分组交换融合方法》读书笔记

    简介 在论文<Is IP going to take over the world (of communications)?>中作者对IP相关的一些说法(假设)提出了质疑,并得出结论:虽然 ...

  4. tp5 ThinkPHP5 自定义异常处理类

    在项目的开发过程中异常抛出尤为重要不仅能够做出友好提示帮助掩盖我们伟大的程序员们尴尬的瞬间,还能做到提示开发人员代码白编写的错误,下面进行自定义异常抛出类,纯属个人理解,希望大家指正 首先在框架中我们 ...

  5. 华为模拟器eNSP基本命令

    华为模拟器eNSP常用命令 本文转自:https://blog.csdn.net/Key_book/article/details/80542264 路由器命令行常用命令: 1. system-vie ...

  6. django中的Form和ModelForm中的问题

    django的Form组件中,如果字段中包含choices参数,请使用两种方式实现数据源实时更新 方法一:重写构造方法,在构造方法中重新去获取值 class UserForm(forms.Form): ...

  7. git 命令 git status add rm commit mv

    1.查看 git 仓库文件改动状态 Git 仓库内文件改动有 4 种状态,除了 Unmodified 状态的文件因为并未改动默认没有状态不做显示之外,其他文件改动状态都可以通过 git status ...

  8. Node KOA框架入门

    KOA: v1 generator v2 过渡版 generator&async v3 async/await koa koa不带路由 因此得cnpm i koa-router -D 路由:1 ...

  9. Archlinux开启ssh服务命令

    Archlinux开启ssh服务命令: systemctl enable sshd.service 开机启动 systemctl start sshd.service 立即启动 systemctl r ...

  10. 阿里云云计算ACP专业认证考试

    阿里云云计算专业认证(Alibaba Cloud Certified Professional,ACP)是面向使用阿里云云计算产品的架构.开发.运维类人员的专业技术认证. 更多阿里云云计算ACP专业认 ...