2017-10-07 55 views
1

我在我的应用程序中使用了RatingBar。我想删除阴影(它们在截图上标有下划线),但我不知道如何去做。在RatingBar中禁用阴影

我的风格:

<style name="RatingBar" parent="Theme.AppCompat"> 
    <item name="colorControlNormal">@color/colorAccent</item> 
    <item name="colorControlActivated">@color/colorAccent</item> 
    <item name="colorControlHighlight">@color/colorAccent</item> 
    <item name="colorPrimary">@color/colorAccent</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

你能告诉我如何删除阴影?

Shadow in RatingBar

+0

尝试在您的主题中设置标高为0dp –

+0

我试过了。它不起作用 –

+0

您是否找到解决方案?也面临同样的问题! –

回答

0

我面临同样的问题了。我想到了。 1索引处的drawable改变阴影颜色。您可以将其设置为实际填充的星形颜色的颜色要浅得多。

RatingBar ratingBar = footer.findViewById(R.id.ratingBar); 
     LayerDrawable stars = (LayerDrawable) ratingBar.getProgressDrawable(); 
     stars.getDrawable(0).setColorFilter(Color.parseColor("#b0b0b0"), PorterDuff.Mode.SRC_ATOP); 
     stars.getDrawable(1).setColorFilter(Color.parseColor("#fff9ee"), PorterDuff.Mode.SRC_ATOP);// This line changes the color of the shadow under the stars 
     stars.getDrawable(2).setColorFilter(Color.parseColor("#FEBE55"), PorterDuff.Mode.SRC_ATOP); 
     ratingBar.setProgressDrawable(stars);