Android SeekBar自定义UI
2012-02-24 16:59
351 查看
1.制作好相应的图片,放入res/drawable-xxxx文件夹下
2、在 /res/drawable/ 下新建两个文件:seek_img.xml thumb.xml
seek_img.xml
thumb.xml
3、定义好上面两个xml后,就可以在 /res/layout/main.xml中调用它们了。
2、在 /res/drawable/ 下新建两个文件:seek_img.xml thumb.xml
seek_img.xml
<?xml version="1.0" encoding="utf-8"?><layer-listxmlns:android="http://schemas.android.com/apk/res/android"><!-- 背景图 --> <item android:id="@+android:id/background" android:drawable="@drawable/total"/> <!--全部能量图 --> <item android:id="@+android:id/SecondaryProgress" android:drawable="@drawable/total"/> <!-- 进和能量图 --> <item android:id="@+android:id/progress" android:drawable="@drawable/part"/></layer-list>
thumb.xml
<?xml version="1.0" encoding="utf-8"?><selectorxmlns:android="http://schemas.android.com/apk/res/android"> <!-- 按下状态 --> <item android:state_pressed="true"android:state_focused="true" android:drawable="@drawable/point"/> <!-- 普通无焦点状态 --> <item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/point"/></selector>
3、定义好上面两个xml后,就可以在 /res/layout/main.xml中调用它们了。
<?xml version="1.0" encoding="utf-8"?><LinearLayoutxmlns: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/sBar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_centerInParent="true" android:minHeight="5dip" android:maxHeight="5dip" android:progressDrawable="@drawable/seek_img" android:thumb="@drawable/thumb"/></LinearLayout>
相关文章推荐
- Android SeekBar自定义UI
- 【Android UI】自定义圆形SeekBar和自定义Dialog的结合使用
- Android UI之自定义SeekBar
- Android 自定义UI-垂直方向的SeekBar
- Android自定义UI文章汇总
- Android自定义UI实战(基础篇2)---搜索酷炫界面【转】
- 【自定义View系列】android的UI结构
- Android 控件学习--自定义SeekBar
- Android UI 之 SeekBar
- Android 自定义Seekbar
- [android UI]自定义各种UI,收集在此,以备后用!
- Android自定义UI实战(基础篇3)---图标圆弧运动
- Android UI 绘制过程浅析(五)自定义View
- 某android平板项目开发笔记--自定义sharepreference UI
- Android UI 之一步步教你自定义控件(自定义属性、合理设计onMeasure、合理设计onDraw等)
- android自定义UI模板图文详解
- Android组件之SeekBar自定义
- Android UI学习之SeekBar
- Android自定义Seekbar拖动条式样
- Android UI设计之<十二>自定义View,实现绚丽的字体大小控制控件FontSliderBar