繁体   English   中英

RatingBar明星表现出奇怪的效果

[英]RatingBar stars shows weird effect

我正在使用评级栏在我的应用中显示电影评级。 在我的布局文件中放置这样的评级栏:

               <RatingBar
                android:id="@+id/RatingBar"
                style="@style/MicRatingBar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10dp"
                android:layout_marginTop="2dp"
                android:layout_toRightOf="@+id/movie_img"
                android:isIndicator="true"
                android:numStars="5"
                android:rating="3.0"
                android:stepSize="1"
                android:textColor="@drawable/button_text" />

在样式部分,我已经分配了minHeight和maxHeight 9dp,这减少了奇怪但没有完全消失。 我的评级栏看起来像这样。 这些线是什么 请帮忙。 提前致谢。

在此输入图像描述

风格部分是这样的:

<style name="MicRatingBar" parent="@android:style/Widget.RatingBar">
    <item name="android:progressDrawable">@drawable/custom_rating_selector</item>
    <item name="android:minHeight">9dip</item>
    <item name="android:maxHeight">9dip</item> 
</style>

请查看minHeight中的View类和maxHeight of ProgressBar(View类中没有maxHeight属性)。 当你设置android:layout_height="wrap_content" ,它会尝试将自己测量到你提供的最小高度。 如果你看到AbsSeekBar的onMeasure(...) ,你可以得到更广泛的想法(RatingBar扩展AbsSeekBar)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM