當前位置: 首頁>>代碼示例>>Java>>正文


Java GridLayoutManager.HORIZONTAL屬性代碼示例

本文整理匯總了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));
}
 
開發者ID:kevinhqf,項目名稱:TVRecyclerView,代碼行數:15,代碼來源:MainActivity.java

示例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;
}
 
開發者ID:Joel-Raju,項目名稱:gamer-inside,代碼行數:37,代碼來源:GameDetailFragment.java

示例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;
}
 
開發者ID:Joel-Raju,項目名稱:gamer-inside,代碼行數:34,代碼來源:DiscoverGamesFragment.java


注:本文中的android.support.v7.widget.GridLayoutManager.HORIZONTAL屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。