我是Android新手,希望我的问题足够清楚。我在适配器的某个位置有一个图像和一个评级栏,我将它们添加到片段中。我希望图像的亮度随着用户更改 Ratingbar 上的评级而改变,但不知道从哪里开始。这是我实例化包含它们的布局的函数:
@Override
public Object instantiateItem(ViewGroup container, int position) {
LayoutInflater inflater = (LayoutInflater)container.getContext().getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.rmd1_custom_imageslider_layout, null);
ImageView image=(ImageView) layout.findViewById(R.id.myimage);
image.setImageResource(CriteriaImages.get(position));
TextView text=(TextView) layout.findViewById(R.id.myImageViewText);
text.setText("Rate my "+CriteriaNames.get(position)+" today");
RatingBar rating = (RatingBar) layout.findViewById(R.id.ratingCategory);
rating.setId(position);
Button btn=(Button) layout.findViewById(R.id.done_button);
((ViewPager) container).addView(layout);
return layout;
}