- 浏览: 262302 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
zhanght327:
现在这个办法不好使了。。。火狐 谷歌 IE 360 迅雷 都不 ...
Aptana插件版Zip包下载方法 -
admins:
一般重启eclipse 与虚拟机就好了。或者看看logcat设 ...
Logcat问题的解决方法 -
CoolYJCK:
这个zip包用不了~~
Aptana插件版Zip包下载方法 -
crazysumer:
嗯,没有prepare报错了
Android的MediaPlayer错误 -
extjavaee:
问题就在于在layout中的决定ListView或 ...
ListView与Adapter使用要点
使用SeekBar的时候,经常遇到的问题有如下:
1. seekbar的拖动按钮没有居中。
2. seekbar的高度有问题。
3. seekbar的拖动按钮在最左最右显示不全。
首先,要解决上述问题,要先检查layout文件在描述seekbar时,有没有正确设置图片的尺寸和检查屏幕密度与图片是否放置在相应的drawable文件夹中(drawable-hdpi, drawable-mdpi, drawable-ldpi).
在确保图片资源正确的情况下,参考如下XML:
layout
<SeekBar android:layout_width="321px" android:layout_height="wrap_content" android:layout_centerInParent="true" android:maxHeight="12px" android:minHeight="12px" android:paddingLeft="18px" android:paddingRight="18px" android:max="100" android:progressDrawable="@drawable/seekbar_style" android:thumb="@drawable/drag_ball" android:id="@+id/seekBar"/>
seekbar_style
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background" android:drawable="@drawable/drag_bar_background"/> <item android:id="@android:id/progress" android:drawable="@drawable/drag_bar_foreground"/> <item android:id="@android:id/secondaryProgress" android:drawable="@drawable/drag_bar_foreground"/> </layer-list>
简单解释下seekbar中几个重要的属性:
android:layout_height="wrap_content"
//建议使用wrap_content,否则一定要保证设置的值不小于seekbar图片资源中的最高值
android:maxHeight="12px"
android:minHeight="12px"
//说明进度条的最低和最大高度,解决高度问题。
android:paddingLeft="18px"
android:paddingRight="18px"
//解决拖动按钮在最左最右显示不全的问题,padding的值一般是thumb的一半宽度。
android:progressDrawable="@drawable/seekbar_style"
//设置了此值,就表示使用自定义的进度条样式,在其中可以设置进度条背景图,进度条图,缓冲条图。
android:thumb="@drawable/drag_ball"
//seekbar的拖动按钮图片
android系统自带的自定义样式例子:
seekbar_style
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <corners android:radius="5dip" /> <gradient android:startColor="#ff9d9e9d" android:centerColor="#ff5a5d5a" android:centerY="0.75" android:endColor="#ff747674" android:angle="270"/> </shape> </item> <item android:id="@android:id/secondaryProgress"> <clip> <shape> <corners android:radius="5dip" /> <gradient android:startColor="#80ffd300" android:centerColor="#80ffb600" android:centerY="0.75" android:endColor="#a0ffcb00" android:angle="270"/> </shape> </clip> </item> <item android:id="@android:id/progress"> <clip> <shape> <corners android:radius="5dip" /> <gradient android:startColor="#ff0099CC" android:centerColor="#ff3399CC" android:centerY="0.75" android:endColor="#ff6699CC" android:angle="270"/> </shape> </clip> </item> </layer-list>
thumb
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 按下状态--> <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/thumb_pressed" /> <!-- 普通无焦点状态 --> <item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/thumb_normal" /> <!-- 有焦点状态--> <item android:state_focused="true" android:state_pressed="false" android:drawable="@drawable/thumb_focused" /> <!-- 有焦点 --> <item android:state_focused="true" android:drawable="@drawable/thumb_focused" /> </selector>
评论
3 楼
zhongyuanceshi
2013-01-05
我的滑块刚开始跑的速度和drag_bar_foreground速度一样的,后面就比它慢。drag_bar_foreground了末尾,但滑块还没到,请问这个怎样修改?
2 楼
arimood
2012-11-13
顶!比那些千篇一律不带解释的seekbar介绍好很多
1 楼
libo19881179
2012-07-02
很不错,最近用到了,转载下 谢谢
发表评论
-
电脑能上网,Android模拟器不能上网的问题
2013-04-23 10:34 7034电脑能上网,Android模拟器不能上网 一 ... -
Android SDK相关问题
2012-11-15 10:57 20791. Android SDK Manager 卡在Fet ... -
Android环境
2012-07-02 10:16 801developer : developer.android.c ... -
xxx is not translated in yyy, zzz 的解决方法
2012-05-12 19:52 29448在Android SDK Tool r19之后, Export ... -
Android MAT
2012-03-01 11:23 3260安装MAT 生成hprof文件: DDMS-D ... -
分辨率不同的兼容要点
2011-11-15 12:55 0分辨率不同的兼容要点1. 换算比率l : m : h = 0. ... -
Android模拟器快捷键
2011-11-15 00:19 1037F1/PgUp Menu key 菜单键 ... -
Android中shared_prefs文件夹位置
2011-11-13 19:01 14976Android中shared_prefs文件夹位置 一 ... -
Android Device中添加busybox
2011-11-10 23:28 7483Android自带的toolbox(位于/system/bin ... -
Android adb shell
2011-11-04 23:28 11021、获取模拟器/设备列表 adb devices 2 ... -
Android SurfaceView
2011-10-31 12:01 1772最近自己做了个指南针应用,用到了SurfaceView。总结下 ... -
常见Layout的LayoutParams总结
2011-09-28 12:33 11791LayoutParams java.lang.O ... -
Logcat问题的解决方法
2011-09-28 09:40 5330Logcat在Android开发中是相当有用的。 但是,Lo ... -
Android中的数据存储与传输
2011-09-27 11:16 1094以下是工作中的开发总结,如有不妥,望请指出,谢谢! A ... -
ListView与Adapter使用要点
2011-08-12 14:44 14424项目用到ListView,由于要用到 ImageView ... -
Android的MediaPlayer错误
2011-07-22 12:43 24082在使用MediaPlayer的时候,要注意几个Listener ... -
Activity的setContentView与findViewById
2011-07-08 09:54 38451. Activity.setContentView(int ... -
Android要点
2011-05-23 22:48 0控制层 Activity Intent and Inten ... -
Android Layout 相关
2011-05-23 11:38 9691 假如在同一个layout文件中有2个或以上的view使用相 ... -
Android界面元素
2011-05-17 11:15 8471 界面元素的层次 View与GroupView View ...
相关推荐
安卓 android seekbar 自定义滑块 适合做音量调节 比较漂亮 我的资源汇总:http://blog.csdn.net/u013506037/article/details/39210793
一个横竖向都可以的SeekBar 控件
android seekbar 源码
Android SeekBar弹框,一个seekBar的源码例子,当拖动SeekBar时上面会有一个弹框显示进度。(注:有广告)
android seekbar 双向选择的进度条
改造的seekbar 自定义还带提示。带自定义视图。
自定义的 SeekBar 样式,实现很简单,有需要的可以看看,本demo是仿酷狗SeekBar 的样式,进度条上小圆球可以随意拖动,如果不需要小圆球的只需要将main.xml里面的android:thumb="@drawable/seek_thumb"去掉就行了...
Android通过SeekBar进行调节字体色,同时设置背景为字体的反色,由于精度设置的较小,增长的幅度为1个百分点,导致有些颜色没有,需要的自己去设精度,代码比较简单
先来上个效果图: 当滑动时:数值显示,滑动停止时显示数字,使用FrameLayout结合SeekBar。 首先我们看看。 Layout: <?xml version=1.0 encoding=utf-... android:id=@+id/wrapper_seekbar_indicator android:la
android 滑块 、android seekBar Demo,可以调节音量等,可自己更换图片。
通过SeekBar控制系统音量,具体请查看http://blog.csdn.net/a1533588867/article/details/53738027
Android自定义SeekBar滑动条
Android seekbar滑动按钮源码
android 自定义Seekbar,包括图片,背景颜色,网上的小例子
android_SeekBar竖直显示自定义背景thumb完美Demo(附带解决说明)
ArcSeekBar 弯曲的Android SeekBar
android SeekBar Test
Android双向seekbar(带刻度),自定义view,控制上限和下限
自定义的圆弧行SeekBar。(PS:不支持0%-100%跳转)