关于自定义SeekBar写法以及seekbar不显示的问题
来源:互联网 发布:淘宝手机充值软件利润 编辑:程序博客网 时间:2024/05/16 18:55
最近写seekbar的时候突然遇到一个问题,就是内容都设置好了但是就是不显示,界面上空空的,初始代码如下
<SeekBar android:id="@+id/playbar_sb_quick_player_bar" style="@style/seekbar_style" android:layout_width="match_parent" android:layout_height="6dp"/>
style文件seekbar_style布局如下,thumb是seekbar的滑块,因为滑块会被覆盖一部分,thumbOffset是设置滑块的左边距,使其不被覆盖
<style name="seekbar_style" parent="@android:style/Widget.SeekBar"> <item name="android:indeterminateOnly">false</item> <item name="android:minHeight">@dimen/y6</item> <item name="android:maxHeight">@dimen/y6</item> <item name="android:indeterminateDrawable">@android:drawable/progress_indeterminate_horizontal</item> <item name="android:progressDrawable">@drawable/seekbar_horizontal</item> <item name="android:thumb">@drawable/f_playing_point</item> <item name="android:thumbOffset">2.0dp</item> </style>
其中seekbar_horizontal.xml文件布局如下
<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background" android:drawable="@drawable/bg"> </item> <item android:id="@android:id/secondaryProgress"> <clip> <shape> <corners android:radius="2.0dip"/> <gradient android:angle="270.0" android:centerColor="#a5a5a5" android:centerY="0.5" android:endColor="#a5a5a5" android:startColor="#a5a5a5"/> </shape> </clip> </item> <item android:id="@android:id/progress"> <clip> <shape> <corners android:radius="2.0dip"/> <gradient android:angle="270.0" android:centerColor="#fa8100" android:centerY="0.5" android:endColor="#fa8100" android:startColor="#fa8100" /> </shape> </clip> </item></layer-list>
此处的gra是渐变的shape,startColor,centerColor,endColor分别是初始,中间,结束颜色,此处为了方便都设置为一种颜色
至此,自定义seekbar圆满结束,但是运行的时候发现seekbar没有显示
排查发现是因为seekbar的height设置了具体的大小6dp导致的,应该是
<SeekBar style="@style/seekbar_style" android:layout_width="match_parent" android:layout_height="wrap_content"/>
解决问题
1 0
- 关于自定义SeekBar写法以及seekbar不显示的问题
- 自定义seekbar 背景色不显示/进度条不在中间的问题
- Android自定义Seekbar的正确写法
- Android 自定义SeekBar以及几个要注意的问题
- 关于seekbar的一些问题
- 解决自定义seekbar和listview显示冲突的问题
- 基础的seekbar写法
- SeekBar,thumb不居中显示的解决办法
- SeekBar thumb不居中显示的解决办法
- SeekBar,thumb不居中显示的解决办法
- 垂直的SeekBar以及自定义布局
- 带数字显示的自定义SeekBar
- android 自定义SeekBar 问题
- 【SeekBar】Android 自定义漂亮的SeekBar样式
- SeekBar 的自定义样式
- 自定义竖着的SeekBar
- 自定义风格的SeekBar
- 自定义Seekbar的注意事项
- typecho 不能上传附件,上传附件失败
- Linux下网卡eth1如何修改为eth0
- leetcode-110. Balanced Binary Tree
- nginx作为下载文件服务器
- SQL基本语句
- 关于自定义SeekBar写法以及seekbar不显示的问题
- CentOS 6.4安装Qt5.0.1
- fragment的懒加载
- Lua学习笔记-2
- 解决 shasum check failed 错误
- 采用富文本编辑器,潜在危险问题
- Call to a member function assign() on a non-object
- 3D Touch
- iOS上传文件或base64(图片)之AFNetworking 3.0+上传文件上传图片