首页 \ 问答 \ 定制评级栏?(Custom rating bar?)

定制评级栏?(Custom rating bar?)

我有一个布局。我在其中嵌入了一个自定义评级栏:

<RatingBar
            android:id="@id/rate"
            style="?android:attr/ratingBarStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5.0dip"
            android:isIndicator="true"
            android:max="5"
            android:numStars="5"
            android:progressDrawable="@drawable/ratebar_theme"
            android:stepSize="0.1" />

它是ratebar_theme

<?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/star_empty_show"/>

    <item
        android:id="@android:id/secondaryProgress"
        android:drawable="@drawable/star_empty_show"/>

    <item
        android:id="@android:id/progress"
        android:drawable="@drawable/star_filled_show"/>

</layer-list>

star_empty_showstar_filled_show都是star_filled_showdrawable文件夹中的.png文件。上面的代码没有错误,但在Graphical layout选项卡中我看到:

Failed to parse file E:\...\res\drawable\ratebar_theme.xml

Error Log我看到了这个:

  org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable

但我已经为每个drawable添加了drawable属性。是否知道为什么会出现这个错误?


I have a layout.I have embedded a custom rating bar in it:

<RatingBar
            android:id="@id/rate"
            style="?android:attr/ratingBarStyleSmall"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5.0dip"
            android:isIndicator="true"
            android:max="5"
            android:numStars="5"
            android:progressDrawable="@drawable/ratebar_theme"
            android:stepSize="0.1" />

It is ratebar_theme:

<?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/star_empty_show"/>

    <item
        android:id="@android:id/secondaryProgress"
        android:drawable="@drawable/star_empty_show"/>

    <item
        android:id="@android:id/progress"
        android:drawable="@drawable/star_filled_show"/>

</layer-list>

Both star_empty_show and star_filled_show are .png files in drawable folder of project.Both above codes have no error,but in Graphical layout tab I see this:

Failed to parse file E:\...\res\drawable\ratebar_theme.xml

And in Error Log I see this:

  org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable

But I have add drawable attribute to each item.Do ypu know why this error occures?


原文:https://stackoverflow.com/questions/14439523
更新时间:2021-12-19 20:12

最满意答案

如果你有easy_install,或者更好的pip安装,应该像下面这样简单:

  1. easy_install/pip install virtualenv
  2. mkdir django1.2
  3. virtualenv django1.2

这会将python二进制文件放在django1.2文件夹中的bin文件夹中。 只需使用那个python二进制文件,你就拥有了一个很好的小型自包含环境。 然后,您可以将easy_install / pip安装到环境中,然后安装django 1.2并进行黑客攻击。


If you have easy_install, or better yet pip installed, should be as easy as:

  1. easy_install/pip install virtualenv
  2. mkdir django1.2
  3. virtualenv django1.2

This will put the python binary in a bin folder inside the django1.2 folder. Just use that python binary, and you've got a nice little self-contained environment. You can then install easy_install/pip into that environment, and then install django 1.2 as well, and hack away.

相关问答

更多
  • 你可能有一个不需要** kwargs的自定义Model.save()方法。 看看文档 。 You probably have a custom Model.save() method that does not take **kwargs. Have a look at the docs.
  • 要检索csrf令牌本身,您需要使用一些Django的内部。 首先,将此行包含在视图的顶部。 from django.middleware.csrf import get_token 现在,在将参数传递给模板时,请执行类似的操作 def my_view(request): return render_to_response("index.html", {"csrf_token": get_token(request)}) 在您的模板中,只需使用{{ csrf_token }}引用令牌。 To re ...
  • 我不确定翻译导入。 一切都可以去。 我猜你是需要翻译导入的,它应该在第一次导入webapp之后完成。 I'm not sure about the translation import. Everything else can go. I'm guessing that were you need the translation import, it should be done after first importing webapp.
  • Django 1.2支持多个DB,而您运行的South版本则不支持。 尝试检查一个更新的版本 - 据说这是固定在0.6的某个点 ,并应该在0.7。 Django 1.2 supports multiple DB's, and the version of South you are running does not. Try checking out a more recent version - supposedly this was fixed at some point in 0.6, and sho ...
  • 如果你有easy_install,或者更好的pip安装,应该像下面这样简单: easy_install/pip install virtualenv mkdir django1.2 virtualenv django1.2 这会将python二进制文件放在django1.2文件夹中的bin文件夹中。 只需使用那个python二进制文件,你就拥有了一个很好的小型自包含环境。 然后,您可以将easy_install / pip安装到该环境中,然后安装django 1.2并进行黑客攻击。 If you have ...
  • 当匿名用户尝试转到/ editor / 25(例如)并重定向到登录进行身份验证时,“next”始终为None,即使它存在于url中(它应该是“/ editor / 25”)。 这听起来很奇怪。 你能检查一下URL确实有?next=/editor/25/作为查询字符串? 同时记录request.GET ,看看会发生什么。 此外,您可能希望从request.GET获取next参数,并在呈现模板时将其作为(可选)隐藏输入包含在表单中。 auth模块的login视图执行此操作。 这样你的表单就可以从POST req ...
  • 如果您已经检查了auth.login的模板,您会注意到
    标记中明确包含了CSRF令牌。 {% csrf_token %} 当在GET请求上呈现页面时,这会扩展为隐藏字段。 就像是:
  • Django API非常稳定,因此您可能根本不需要重写它(除非您真的想要)。 我有一个我在2007年用0.97-pre做过的网站 - 至少我认为这就是他们所说的,它是主干6688.无论如何,我已经将网站移植了两次,一次移植到1.0然后移到1.1.1。 我们必须处理的唯一“主要”事情是管理员进入自己的文件,但这主要是在编辑器中进行剪切和粘贴以及一些调整。 你会遇到像maxlength这样的小东西,如max_length等,但这很容易处理。 检查向后不兼容的更改列表, 在此处 ,以及此处查看是否有任何内容跳出来 ...
  • 我想你想尝试MinLengthValidator而不是MinValueValidator 。 MinValueValidator检查字段值是否大于或等于给定值。 >>> 's' > 2 True 由于"s" > 2 ,因此不会引发验证错误。 将MinValueError与IntegerField或FloatField一起使用会更有意义。 >>> field = forms.FloatField(validators=[validators.MinValueValidator(2)]) >>> field. ...
  • django文档非常好,您应该找到大多数问题的答案http://docs.djangoproject.com/en/1.2/ 你可以轻松谷歌,但要确保你在django 1.2的doc页面上。 对于模式迁移,我建议查看南http://south.aeracode.org/ 在我看来,南方是网站的必备功能。 入门非常简单快捷。 他们网站上的教程应该可以帮到你。 我认为如果你打算在周末进行一些模式迁移,这将是一个很大的帮助。 如果没有,你可以稍等一下。 我从来没有在inspectdb生成的数据库上使用南,但我猜它 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)