如何做到以下几点?
如果RatingBar有1-3颗星 - 红星.如果RatingBar有4颗星 - 黄星.如果RatingBar有5颗星 - 绿色星星.
((RatingBar) layout.findViewById(R.id.ratingBar)).setProgress(Integer.parseInt(surveyBeans.get(section).get(position).getRate()));
<RatingBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ratingBar" android:stepSize="1" android:clickable="false"
style="?android:attr/ratingBarStyleSmall" android:layout_gravity="right"
android:layout_marginRight="15dp" />
Run Code Online (Sandbox Code Playgroud)
编辑:
@Override
public View getItemView(int section, int position, View convertView, ViewGroup parent) {
LinearLayout layout;
if (convertView == null) {
LayoutInflater inflator = (LayoutInflater) parent.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
layout = (LinearLayout) inflator.inflate(R.layout.item_survey, null);
} else {
layout = (LinearLayout) convertView;
}
((TextView) layout.findViewById(R.id.questionSurvey)).setText(surveyBeans.get(section).get(position).getQuestion());
RatingBar ratingBar = ((RatingBar) layout.findViewById(R.id.ratingBar));
ratingBar.setProgress(Integer.parseInt(surveyBeans.get(section).get(position).getRate()));
LayerDrawable stars = (LayerDrawable) ratingBar.getProgressDrawable();
stars.getDrawable(2).setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_ATOP);
stars.getDrawable(1).setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP);
((TextView) layout.findViewById(R.id.commentSurvey)).setText(surveyBeans.get(section).get(position).getComment());
return layout;
} …Run Code Online (Sandbox Code Playgroud) 如何将android datepicker控件的初始大小调整为更小或更大.有没有办法重新实现它?
找不到如何实现这样的控制,甚至不知道它的名字:

每个1,2和3个元素都是相同的自定义控件(让它们命名为项目).物品应该可以通过手指在两个方向上滑动,并且(通过按照控制下方的点点击也会很棒).重要的是要在屏幕上看到整个单项(不是第1部分和第2部分ListView).
它可以在Android上实现吗?如果是,请说明如何执行此操作并告诉我该控件的名称.