【问题标题】:Problem with custom rating bar in androidandroid中自定义评分栏的问题
【发布时间】:2011-06-14 22:45:27
【问题描述】:

我按照此处的说明实现了自定义评分栏

How to create Custom Ratings bar in Android

但是当我尝试制作评分栏的 minHeight

虽然我想制作这种尺寸的评分栏

我是否必须根据评分栏的最大和最小高度调整我在可绘制中使用的图像的大小?

【问题讨论】:

    标签: android


    【解决方案1】:

    问题可能与屏幕分辨率有关。尝试将其添加到您的清单文件中:

     <?xml version="1.0" encoding="utf-8"?>
        <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.main" android:versionCode="1" android:versionName="1.0">
        <supports-screens android:smallScreens="true"
            android:normalScreens="true" android:largeScreens="true"
            android:anyDensity="true" />
    ...
    

    更多信息在这里:http://www.jdamcd.com/?p=303

    你也可以尝试设置style="?android:attr/ratingBarStyleSmall

    【讨论】:

    • 我是在主目录中设置样式还是什么?我真的不明白:(
    • 你应该把它放在你的 AndroidManifest.xml 中:&lt;supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" /&gt; 如果你愿意,可以尝试在你的布局 xml 文件中设置 style="?android:attr/ratingBarStyleSmall
    • no support-screens 标签没有影响我的程序,所以我在询问 style="?android:attr
    • 示例:&lt;RatingBar android:id="@+id/ratingBar" style="?android:attr/ratingBarStyleSmall" android:layout_gravity="center_vertical|center_horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt;&lt;/RatingBar&gt;
    • 我可以在我使用的这个内置评分栏或我之前制作的其他评分栏中控制评分栏的宽度或每个星之间的间距吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-28
    • 1970-01-01
    • 2012-12-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多