本文整理汇总了Java中android.support.v7.widget.GridLayoutManager.HORIZONTAL属性的典型用法代码示例。如果您正苦于以下问题:Java GridLayoutManager.HORIZONTAL属性的具体用法?Java GridLayoutManager.HORIZONTAL怎么用?Java GridLayoutManager.HORIZONTAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.support.v7.widget.GridLayoutManager
的用法示例。
在下文中一共展示了GridLayoutManager.HORIZONTAL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
private void initView() {
rv = (TVRecyclerView) findViewById(R.id.rv_list);
GridLayoutManager manager = new GridLayoutManager(this, 3, GridLayoutManager.HORIZONTAL, false);
manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (position % 5 == 0)
return 2;
return 1;
}
});
rv.setLayoutManager(manager);
rv.setAdapter(new SimpleTVRecyclerViewAdapter(this));
rv.addItemDecoration(new DefaultItemDecoration(5,5, 0, 0));
}
示例2: onCreateView
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_game_detail, container, false);
GridLayoutManager imageGalleryLayoutManager = new GridLayoutManager(getContext(), 1,
GridLayoutManager.HORIZONTAL, false);
GridLayoutManager videoGalleryLayoutManager = new GridLayoutManager(getContext(), 1,
GridLayoutManager.HORIZONTAL, false);
mContent = (RelativeLayout) view.findViewById(R.id.content);
mContentLoading = (RelativeLayout) view.findViewById(R.id.content_loading_progress);
mGameTitle = (TextView) view.findViewById(R.id.game_title);
mInitialReleaseDate = (TextView) view.findViewById(R.id.game_release_date);
gameHeaderImage = (ImageView) view.findViewById(R.id.game_header_image);
gameTitleToolbar = (Toolbar) view.findViewById(R.id.game_detail_toolbar);
gameSummary = (TextView) view.findViewById(R.id.game_summary);
gameStoryLine = (TextView) view.findViewById(R.id.game_storyline);
mGamePlatforms = (TextView) view.findViewById(R.id.game_platforms);
mGamerRating = (ProgressBar) view.findViewById(R.id.game_gamer_rating);
mCriticRating = (ProgressBar) view.findViewById(R.id.game_critic_rating);
mCriticsRatingValue = (TextView) view.findViewById(R.id.game_critic_rating_value);
mGamerRatingValue = (TextView) view.findViewById(R.id.game_gamer_rating_value);
mGameStorylineContent = (LinearLayout) view.findViewById(R.id.game_storyline_content);
mGameRatingContent = (LinearLayout) view.findViewById(R.id.game_rating_content);
mVideoGalleryContent = (LinearLayout) view.findViewById(R.id.game_video_gallery_content);
mImageGalleryContent = (LinearLayout) view.findViewById(R.id.game_image_gallery_content);
gameImageGalleryView = (RecyclerView) view.findViewById(R.id.game_image_gallery);
gameVideoGalleryView = (RecyclerView) view.findViewById(R.id.game_video_gallery);
gameImageGalleryView.setLayoutManager(imageGalleryLayoutManager);
gameVideoGalleryView.setLayoutManager(videoGalleryLayoutManager);
gameImageGalleryView.setAdapter(mImageGalleryAdapter);
gameVideoGalleryView.setAdapter(mVideoGalleryAdapter);
return view;
}
示例3: onCreateView
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_discover_games, container, false);
GridLayoutManager popularGamesLayoutManager = new GridLayoutManager(getContext(), 1, GridLayoutManager.HORIZONTAL, false);
GridLayoutManager mostAnticipatedGamesLayoutManager = new GridLayoutManager(getContext(), 1, GridLayoutManager.HORIZONTAL, false);
GridLayoutManager upcomingGamesLayoutManager = new GridLayoutManager(getContext(), 1, GridLayoutManager.HORIZONTAL, false);
RecyclerView popularGamesRecyclerView = (RecyclerView) view.findViewById(R.id.popular_games_list);
RecyclerView mostAnticipatedGamesRecyclerView = (RecyclerView) view.findViewById(R.id.most_anticipated_games_list);
RecyclerView upcomingGamesRecyclerView = (RecyclerView) view.findViewById(R.id.upcoming_games_list);
mContent = (RelativeLayout) view.findViewById(R.id.content);
mContentLoading = (RelativeLayout) view.findViewById(R.id.content_loading_progress);
// TODO: check https://github.com/rubensousa/RecyclerViewSnap
SnapHelper helper = new LinearSnapHelper();
helper.attachToRecyclerView(popularGamesRecyclerView);
helper.attachToRecyclerView(mostAnticipatedGamesRecyclerView);
helper.attachToRecyclerView(upcomingGamesRecyclerView);
popularGamesRecyclerView.setLayoutManager(popularGamesLayoutManager);
popularGamesRecyclerView.setAdapter(mPopularGamesAdapter);
mostAnticipatedGamesRecyclerView.setLayoutManager(mostAnticipatedGamesLayoutManager);
mostAnticipatedGamesRecyclerView.setAdapter(mMostAnticipatedGamesAdapter);
upcomingGamesRecyclerView.setLayoutManager(upcomingGamesLayoutManager);
upcomingGamesRecyclerView.setAdapter(mUpcomingGamesAdapter);
return view;
}