1.自定义替换提醒☆图片,准备两个图片添加到系统中去:如下:

      

在drewable下定义一个图片资源ratingbar_drawable.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?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/unselect">
</item>
<item
    android:id="@+android:id/secondaryProgress"
    android:drawable="@drawable/unselect">
</item>
<item
    android:id="@+android:id/progress"
    android:drawable="@drawable/selected">
</item>
  
</layer-list>

之后再styles.xml下添加一个标签,这个style继承父style   Widget.RatingBar

 
1
2
3
4
5
6
7
8
9
<style name="roomRatingBar" parent="<a href="http://my.oschina.net/asia" target="_blank" rel="nofollow">@android</a> :style/Widget.RatingBar">
  
<item name="android:progressDrawable">@drawable/ratingbar_drawable</item>
  
<item name="android:minHeight">48dip</item>
  
<item name="android:maxHeight">48dip</item>
  
</style>

之后定义布局文件资源ratingbar.xml;

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
 
    <RatingBar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        style="@style/roomRatingBar"
        android:layout_marginLeft="10dip"
        android:id="@+id/ratingbar"
        android:rating="1.5"
        android:stepSize="0.15"
        android:numStars="8"
    />
</LinearLayout>

运行后的效果:

Android RatingBar自定义替换系统图片的更多相关文章

  1. Android RatingBar 自定义样式

    Android RatingBar 自定义样式 1.先定义Style: <style name="RadingStyle" parent="@android:sty ...

  2. 在Android开发中替换资源图片不起作用的解决方法

    现象 在android开发中,经常会需要替换res\drawable中的图片,打开res\layout下的文件预览布局页面发现图片已经被替换,但在模拟器或者真实机器上运行时发现该图片并没有被替换,还是 ...

  3. Android之自定义ViewPager实现图片的无线轮播

    PS:以前也写过关于图片轮播这一块的博客.不过写的很烂,并且很多情况没有考虑到(没有支持无线轮播,和手势点击事件).因此这里写一篇补上.也是当时太年轻了. 注:图片请放大后再看.否则看不清楚. 学习内 ...

  4. Android progressBar 自定义圆形旋转图片

    项目需要中需要更换progressbar的旋转背景,在网上找了几种办法,但是都有各自的问题 于是结合网上所讲,研究了一下终于ok了: 一 首相在drawable文件夹中建立如下旋转动画文件 <? ...

  5. android中自定义checkbox的图片和大小

    其实很简单,分三步: 1.在drawable中创建文件checkbox_selector.xml: <?xml version="1.0" encoding="ut ...

  6. [转]Android中自定义checkbox样式

    android中自定义checkbox的图片和大小   其实很简单,分三步: 1.在drawable中创建文件checkbox_selector.xml: <?xml version=" ...

  7. Android实现自定义带文字和图片的Button

    Android实现自定义带文字和图片的Button 在Android开发中经常会需要用到带文字和图片的button,下面来讲解一下常用的实现办法. 一.用系统自带的Button实现 最简单的一种办法就 ...

  8. [Android] 对自定义图片浏览器经常内存溢出的一些优化

    首先关于异步加载图片可以参见 夏安明 的博客:http://blog.csdn.net/xiaanming/article/details/9825113 这篇文章最近有了新的更改,大概看了一下,内容 ...

  9. android使用mount挂载/system/app为读写权限,删除或替换系统应用

    注意:以下代码中#开头的则为需要执行的shell命令,其他的为打印的结果.#代表需要使用ROOT权限(su)执行,所以想要修改您android手机某个目录挂载为读写,首先需要有ROOT权限! 先要得到 ...

随机推荐

  1. request.ServerVariables获取环境变量

    Request.ServerVariables("HTTP_X_FORWARDED_FOR")  透过代理服务器取得客户端的真实IP地址,有些用此方法读取到的仍然是代理服务器的IP ...

  2. 安装VS2010后,如何设置老版本的项目文件不是默认用VS2010打开

    1.系统先后安装了VS2008和VS2010,在打开用VS2008创建的项目文件时总是会默认用VS2010打开,选择打开方式都不行,很不方便,差点要把VS2010卸载了.     其实只需要简单设置V ...

  3. timestamp 正常日期转换成时间戳格式

    select cast(sysdate as timestamp) "DATE" from dual select to_timestamp(to_date(sysdate, 'y ...

  4. eclipse提交hadoop集群跑程序

    在eclipse下搭建hadoop后,测试wordcount程序,右击 Run on hadoop 程序跑成功后,发现“INFO - Job job_local401325246_0001 compl ...

  5. Canvas前端游戏开发——FlappyBird详解

    一直想自己做点小东西,直到最近看了本<HTML5游戏开发>,才了解游戏开发中的一点点入门知识. 本篇就针对学习的几个样例,自己动手实践,做了个FlappyBird,源码共享在度盘;也可以参 ...

  6. PHP生成数字+字符混合型字符串

    以下是一个用PHP随机生成字符+数字混合型的随机字符串,可用来生成会员ID.用户密码/密钥等内容,函数简单,代码如下: <?php function generate_rand($l){ $c= ...

  7. PHP获取文件扩展名的多种方法

    PHP获取文件扩展名的N种方法. 第1种方法: function get_extension($file) { substr(strrchr($file, '.'), 1): } 第2种方法: fun ...

  8. 使用Statement执行sql语句

    import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java ...

  9. Visual Studio调试之断点基础篇

    Visual Studio调试之断点基础篇 我曾经问过很多人,你一般是怎么调试你的程序的? F9, F5, F11, F…… 有很多书和文章都是介绍怎么使用Visual Studio编写WinForm ...

  10. jQuery CSS3 照片墙

    <html> <head> <style type="text/css"> .picture-wall-container{ position: ...