在Android中自定义评分栏

在Android中自定义评分栏,第1张

概述我必须设计一个custon列表项,其中包括评分栏我按照本教程([Problemwithcustomratingbarinandroid)来自定义和调整等级栏.等级栏现在正在显示小bt,我无法单击它我的自定义listItem代码为:<TableLayoutxmlns:android="http://schemas.android.com/apkes/android"and

我必须设计一个custon列表项,其中包括评分栏

我按照本教程([Problem with custom rating bar in android)来自定义和调整等级栏.等级栏现在正在显示小bt,我无法单击它

我的自定义ListItem代码为:

<tableLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:stretchColumns="*" androID:layout_wIDth="fill_parent"    androID:layout_height="fill_parent" androID:ID="@+ID/tbl">    <tableRow>        <linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"            androID:orIEntation="vertical" androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content">            <ImageVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID"                androID:orIEntation="vertical" androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content" androID:src="@drawable/icon" />            <TextVIEw androID:layout_wIDth="wrap_content" androID:ID="@+ID/txt"                androID:layout_height="wrap_content" androID:text="Item name" />        </linearLayout>        <linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"            androID:orIEntation="vertical" androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content">            <TextVIEw androID:layout_wIDth="100dp" androID:gravity="center"                androID:layout_height="wrap_content" androID:text="Price" />            <TextVIEw androID:layout_wIDth="100dp" androID:gravity="center"                androID:layout_height="wrap_content" androID:text="discount" />            <TextVIEw androID:layout_wIDth="100dp" androID:gravity="center"                androID:layout_height="wrap_content" androID:text="In Stock" />        </linearLayout>        <linearLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"            androID:orIEntation="vertical" androID:layout_wIDth="wrap_content"            androID:layout_height="wrap_content">            <!-- <ratingbar androID:ID="@+ID/ratingbar1" androID:fitsSystemwindows="false"                 androID:maxWIDth="150dip" androID:minHeight="23dip" androID:maxHeight="25dip"                 androID:layout_height="40dp" androID:layout_wIDth="150dp" /> -->            <TextVIEw androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content" androID:text="ShipPing days" />            <ratingbar androID:ID="@+ID/ratingbar"                 androID:layout_gravity="center_vertical|center_horizontal"                androID:focusable="true" androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"></ratingbar>            <button androID:layout_wIDth="60dip" androID:layout_height="35dip"                androID:text="Buy" androID:textSize="15dip"/>        </linearLayout>    </tableRow></tableLayout>

而screenShot是:

编辑:

我开发了自定义的等级栏,但是现在无论我在横向设置等级还是在纵向查看应用程序时,都不会选择整个等级栏.要保持等级栏怎么做?

解决方法:

较小的ratingbar样式(ratingbarStyleSmall)和较大的仅指示符样式(ratingbarStyleIndicator)不支持用户交互,应仅用作指示符.
(从RatingBar manual起)

总结

以上是内存溢出为你收集整理的在Android中自定义评分栏全部内容,希望文章能够帮你解决在Android中自定义评分栏所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1084547.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存