我像这样动态地创建我的布局。我想将此评级栏中的星星颜色从默认的蓝色更改为黄色。
View insertPhoto( int id, int i){
layout = new LinearLayout(getApplicationContext());
layout.setLayoutParams(new LayoutParams(180, 250));
layout.setGravity(Gravity.CENTER);
layout.setOrientation(1);
layout.setId(i);
FrameLayout fl=new FrameLayout(getApplicationContext());
fl.setLayoutParams(new LayoutParams(116, 116));
imageView = new ImageView(getApplicationContext());
imageView.setLayoutParams(new LayoutParams(116,116));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setImageResource(id);
imageView.setId(i);
imgoff = new ImageView(getApplicationContext());
imgoff.setLayoutParams(new LayoutParams(50,116));
imgoff.setScaleType(ImageView.ScaleType.FIT_END);
imgoff.setImageResource(getResources().getIdentifier("offer","drawable", getPackageName()));
// imgoff.setOnClickListener(listener);
fl.addView(imageView);
fl.addView(imgoff);
tv=new TextView(getApplicationContext());
tv.setLayoutParams(new LayoutParams(116,20));
tv.setText(namesArr[i]);
tv.setTextColor(Color.BLACK);
rb=new RatingBar(getApplicationContext(),null,android.R.attr.ratingBarStyleSmall);
rb.setLayoutParams(new LayoutParams(80,50));
rb.setIsIndicator(true);
rb.setNumStars(5);
rb.setRating(rateFArr[i]);
layout.addView(fl);
layout.addView(tv);
layout.addView(rb);
layout.setOnClickListener(listener);
return layout;
}
请有人帮我解决这个问题。提前致谢。