Я начинаю андроид, и я хочу создать свой собственный рейтинг.
Отказ от ответственности: это не дубликат. потому что все сообщения, которые я прочитал, спрашивают о том, как изменить цвета звезды и как удалить штрих. Это НЕ то, что я хочу. Я хочу иметь инсульт и иметь возможность изменять цвет границы.
С прозрачным и желтым штрихом в то время как пустой, а желтый фон и штрих для половины и заполнены.
Я НЕ хочу использовать png. У меня уже есть свои собственные, но они слишком маленькие. Я просто не хочу просить дизайнера создавать новые, если я могу заставить звезды использовать только атрибуты XML и чертежи.
<RatingBar
android:id="@+id/thread_rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:isIndicator="true"
android:numStars="5"
android:progressBackgroundTint="@color/gray"
android:progressTint="@color/gold"
android:rating="2.5"
android:secondaryProgressTint="@color/gray"
android:stepSize="0.5"
style="?android:attr/ratingBarStyleSmall"
/>
Я работаю над этим с другим инженером. Он также написал код в java файле
private void setRatingBarStart(RatingBar rating_bar) {
LayerDrawable stars = (LayerDrawable) rating_bar.getProgressDrawable();
stars.getDrawable(2)
.setColorFilter(getResources().getColor(R.color.gold),
PorterDuff.Mode.SRC_ATOP); // for filled stars
stars.getDrawable(1)
.setColorFilter(getResources().getColor(R.color.light_gray),
PorterDuff.Mode.SRC_ATOP); // for half filled stars
stars.getDrawable(0)
.setColorFilter(getResources().getColor(R.color.light_gray),
PorterDuff.Mode.SRC_ATOP); // for empty stars
[Итак, теперь он имеет серый фон, желтый для заполнения и НЕТ. Теперь
И я хочу, чтобы у него был прозрачный фон, желтый удар и желтый для заполнения. Похож на это
Я уже знаю, как установить фон прозрачным и сделать его желтым. Я просто не знаю, как установить цвет штриха. Большое спасибо!!!!