本文整理汇总了Java中android.widget.RatingBar类的典型用法代码示例。如果您正苦于以下问题:Java RatingBar类的具体用法?Java RatingBar怎么用?Java RatingBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RatingBar类属于android.widget包,在下文中一共展示了RatingBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.widget.RatingBar; //导入依赖的package包/类
@Override
protected void init() {
list = new ArrayList<>();
adapter = new CommonAdapter<GameInfo>(getActivity(),list,R.layout.layout_game_listview) {
@Override
public void convert(ViewHolder helper, int position, GameInfo item) {
//TODO 控件设置内容
helper.setText(R.id.tv_name_gameList,item.getName());
helper.setText(R.id.tv_count_gameList,"下载总数:"+item.getCount());
helper.setImageByUrl(R.id.iv_icon_gameList,item.getIcon());
RatingBar ratingBar = helper.getView(R.id.rating_bar_gameList);
//设置进度,四舍五入
ratingBar.setProgress( Math.round(item.getScore()));
}
};
lv.setAdapter(adapter);
}
示例2: findViewsAndAssign
import android.widget.RatingBar; //导入依赖的package包/类
private void findViewsAndAssign() {
// find views for station name and image and playback indicator
mStationNameView = (TextView) mRootView.findViewById(R.id.player_textview_stationname);
mtxtDescriptionView = (TextView) mRootView.findViewById(R.id.txtDescription);
mtxtMarkdownDescriptionView = (TextView) mRootView.findViewById(R.id.txtMarkdownDescription);
mRatingBarView = (RatingBar) mRootView.findViewById(R.id.ratingBar);
mStationMetadataView = (TextView) mRootView.findViewById(R.id.player_textview_station_metadata);
mPlaybackIndicator = (ImageView) mRootView.findViewById(R.id.player_playback_indicator);
mPlaybackButton = (ImageButton) mRootView.findViewById(R.id.player_playback_button);
mPlayerFavoritButton = (ImageButton) mRootView.findViewById(R.id.player_item_favorit_button);
mStationImageView = (SimpleDraweeView) mRootView.findViewById(R.id.player_imageview_station_icon);
mStationMenuView = (ImageButton) mRootView.findViewById(R.id.player_item_more_button);
mCrdMarkdownDescriptionView = (CardView) mRootView.findViewById(R.id.crdMarkdownDescription);
mRelLayLargeButtonPlayView = (RelativeLayout) mRootView.findViewById(R.id.relLayLargeButtonPlay);
}
示例3: onCreateView
import android.widget.RatingBar; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_common, null);
DragLayout dragLayout = (DragLayout) rootView.findViewById(R.id.drag_layout);
imageView = (ImageView) dragLayout.findViewById(R.id.image);
ImageLoader.getInstance().displayImage(imageUrl, imageView);
address1 = dragLayout.findViewById(R.id.address1);
address2 = dragLayout.findViewById(R.id.address2);
address3 = dragLayout.findViewById(R.id.address3);
address4 = dragLayout.findViewById(R.id.address4);
address5 = dragLayout.findViewById(R.id.address5);
ratingBar = (RatingBar) dragLayout.findViewById(R.id.rating);
head1 = dragLayout.findViewById(R.id.head1);
head2 = dragLayout.findViewById(R.id.head2);
head3 = dragLayout.findViewById(R.id.head3);
head4 = dragLayout.findViewById(R.id.head4);
dragLayout.setGotoDetailListener(this);
return rootView;
}
示例4: CollectionAdapterViewHolder
import android.widget.RatingBar; //导入依赖的package包/类
public CollectionAdapterViewHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
itemView.setClickable(true);
mListItemLayout = itemView;
mStationImageView = (SimpleDraweeView) itemView.findViewById(R.id.list_item_station_icon);
mStationNameView = (TextView) itemView.findViewById(R.id.list_item_textview);
mLayoutCategoryView = (LinearLayout) itemView.findViewById(R.id.layoutFavorit);
mTxtCategoryView = (TextView) itemView.findViewById(R.id.txtFavorit);
mRatingBarView = (RatingBar) itemView.findViewById(R.id.ratingBar);
mFavoritButton = (ImageButton) itemView.findViewById(R.id.player_item_favorit_button);
mStationDesciptionView = (TextView) itemView.findViewById(R.id.list_item_description);
mPlaybackIndicator = (ImageView) itemView.findViewById(R.id.list_item_playback_indicator);
mStationMenuView = (ImageView) itemView.findViewById(R.id.list_item_more_button);
mFabPlayButton = (FloatingActionButton) itemView.findViewById(R.id.fabPlayButton);
}
示例5: save
import android.widget.RatingBar; //导入依赖的package包/类
/**
* Save review
* @param view view where the button will be shown
*/
private void save(final View view) {
LinearLayout ratingRestaurant = (LinearLayout) findViewById(R.id.rating_restaurant);
RatingBar ratingBar = (RatingBar) ratingRestaurant.findViewById(R.id.rating_bar);
EditText comment = (EditText) ratingRestaurant.findViewById(R.id.form_comment);
if (ratingBar.getRating() == 0 || !isComplete()) {
Snackbar.make(view, getResources().getString(R.string.no_review), Snackbar.LENGTH_LONG).show();
} else {
reviewService.addDishesReview(reviews);
reviewService.addRestaurantReview(orderService.getRestaurantId(order.getId()),
ratingBar.getRating(), comment.getText().toString());
reviewService.deleteOrderToReview(order.getId());
finish();
}
}
示例6: getView
import android.widget.RatingBar; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent){
Dish dish = dishList.get(position);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(MainActivity.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.meal_dish_row, null);
TextView title = (TextView) view.findViewById(R.id.mealDishTitle);
TextView description = (TextView) view.findViewById(R.id.mealDishDescription);
ImageView image = (ImageView) view.findViewById(R.id.mealDishImage);
RatingBar rating = (RatingBar) view.findViewById(R.id.mealDishRating);
title.setText(dish.getTitle());
description.setText(dish.getDescription());
image.setImageBitmap(dish.getBitmap());
rating.setRating(dish.getRating());
return view;
}
示例7: getView
import android.widget.RatingBar; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent){
Meal meal = mealList.get(position);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(MainActivity.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.meal_row, null);
TextView title = (TextView) view.findViewById(R.id.mealTitle);
TextView description = (TextView) view.findViewById(R.id.mealDescription);
TextView location = (TextView) view.findViewById(R.id.mealLocation);
RatingBar rating = (RatingBar) view.findViewById(R.id.mealRating);
ImageView image = (ImageView) view.findViewById(R.id.mealImage);
title.setText(meal.getTitle());
description.setText(meal.getDescription());
location.setText(meal.getLocation());
rating.setRating(meal.getNumStars());
image.setImageBitmap(meal.getBitmap());
return view;
}
示例8: OrderHolder
import android.widget.RatingBar; //导入依赖的package包/类
OrderHolder(View itemView) {
super(itemView);
this.view = itemView;
this.name = (TextView) itemView.findViewById(R.id.name);
this.ratingBar = (RatingBar) itemView.findViewById(R.id.rating_bar);
this.description = (TextView) itemView.findViewById(R.id.description);
this.daysOpen = (TextView) itemView.findViewById(R.id.days_open);
this.dishesCount = (TextView) itemView.findViewById(R.id.dishes_count);
this.menusCount = (TextView) itemView.findViewById(R.id.menus_count);
this.view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), GetRestaurantActivity.class);
intent.putExtra(GetRestaurantActivity.RESTAURANT_ID, item.getId());
v.getContext().startActivity(intent);
}
});
}
示例9: getView
import android.widget.RatingBar; //导入依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent){
Dish dish = dishList.get(position);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(MainActivity.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.dish_row, null);
TextView title = (TextView) view.findViewById(R.id.dishRowName);
TextView description = (TextView) view.findViewById(R.id.dishRowDescription);
ImageView image = (ImageView) view.findViewById(R.id.dishRowImage);
RatingBar rating = (RatingBar) view.findViewById(R.id.dishRowRating);
title.setText(dish.getTitle());
description.setText(dish.getDescription());
image.setImageBitmap(dish.getBitmap());
rating.setRating(dish.getRating());
return view;
}
示例10: CardViewHolder
import android.widget.RatingBar; //导入依赖的package包/类
CardViewHolder(View view) {
super(view);
mUpFlipper = (ViewFlipper) view.findViewById(R.id.mUpFlipper);
mDownFlipper = (ViewFlipper) view.findViewById(R.id.mDownFlipper);
user_name = (TextView) view.findViewById(R.id.review_user_name);
review_date = (TextView) view.findViewById(R.id.review_date);
review_summary = (TextView) view.findViewById(R.id.review_summary);
review_up_score = (TextView) view.findViewById(R.id.review_up_score);
review_down_score = (TextView) view.findViewById(R.id.review_down_score);
review_rating = (RatingBar) view.findViewById(R.id.review_rating);
user_image = (CircleImageView) view.findViewById(R.id.review_user_image);
review_card = (CardView) view.findViewById(R.id.card_review);
review_read_more = (TextView) view.findViewById(R.id.review_read_more);
/*onClickListeners*/
user_image.setOnClickListener(this);
review_read_more.setOnClickListener(this);
review_card.setOnClickListener(this);
mUpFlipper.setOnClickListener(this);
mDownFlipper.setOnClickListener(this);
}
示例11: initView
import android.widget.RatingBar; //导入依赖的package包/类
@Override
protected void initView() {
mPresenter = new MovieCommentPresenterImpl(this, id);
mAdapter = new BaseQuickAdapter<MovieComment,BaseViewHolder>(R.layout.item_comment_list) {
@Override
protected void convert(BaseViewHolder helper, MovieComment item) {
ImageLoadUtil.displayCircle((ImageView) helper.getView(R.id.iv_author_icon),item.getAuthor().getAvatar());
helper.setText(R.id.tv_author_name,item.getAuthor().getName());
((RatingBar)helper.getView(R.id.rb_movie_rating)).setRating((float) item.getRating().getValue());
helper.setText(R.id.tv_useful_count, item.getUseful_count()+"");
helper.setText(R.id.tv_comment_content, item.getContent());
helper.setText(R.id.tv_comment_date, item.getCreated_at());
}
};
mAdapter.setEnableLoadMore(true);
mAdapter.setOnLoadMoreListener(this,mRvComments);
mAdapter.openLoadAnimation();
mRvComments.setLayoutManager(new LinearLayoutManager(getActivity()));
mRvComments.setAdapter(mAdapter);
}
示例12: setRating
import android.widget.RatingBar; //导入依赖的package包/类
public ViewHolder setRating(int viewId, float rating, int max)
{
RatingBar view = getView(viewId);
view.setMax(max);
view.setRating(rating);
return this;
}
示例13: setRating
import android.widget.RatingBar; //导入依赖的package包/类
public ViewHolder setRating(int viewId, float rating)
{
RatingBar view = getView(viewId);
view.setRating(rating);
return this;
}
示例14: setRating
import android.widget.RatingBar; //导入依赖的package包/类
@Override
public MartianViewHolder setRating(int viewId, float rating, int max) {
RatingBar view = getView(viewId);
view.setMax(max);
view.setRating(rating);
return this;
}
示例15: onCreate
import android.widget.RatingBar; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
imageView = (ImageView) findViewById(R.id.image);
address1 = findViewById(R.id.address1);
address2 = findViewById(R.id.address2);
address3 = findViewById(R.id.address3);
address4 = findViewById(R.id.address4);
address5 = findViewById(R.id.address5);
ratingBar = (RatingBar) findViewById(R.id.rating);
listContainer = (LinearLayout) findViewById(R.id.detail_list_container);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window window = getWindow();
window.setFlags(
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
String imageUrl = getIntent().getStringExtra(EXTRA_IMAGE_URL);
ImageLoader.getInstance().displayImage(imageUrl, imageView);
ViewCompat.setTransitionName(imageView, IMAGE_TRANSITION_NAME);
ViewCompat.setTransitionName(address1, ADDRESS1_TRANSITION_NAME);
ViewCompat.setTransitionName(address2, ADDRESS2_TRANSITION_NAME);
ViewCompat.setTransitionName(address3, ADDRESS3_TRANSITION_NAME);
ViewCompat.setTransitionName(address4, ADDRESS4_TRANSITION_NAME);
ViewCompat.setTransitionName(address5, ADDRESS5_TRANSITION_NAME);
ViewCompat.setTransitionName(ratingBar, RATINGBAR_TRANSITION_NAME);
dealListView();
}