当前位置: 首页>>代码示例>>Java>>正文


Java GridLayoutManager.VERTICAL属性代码示例

本文整理汇总了Java中android.support.v7.widget.GridLayoutManager.VERTICAL属性的典型用法代码示例。如果您正苦于以下问题:Java GridLayoutManager.VERTICAL属性的具体用法?Java GridLayoutManager.VERTICAL怎么用?Java GridLayoutManager.VERTICAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.v7.widget.GridLayoutManager的用法示例。


在下文中一共展示了GridLayoutManager.VERTICAL属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initNormalAdapter

private void initNormalAdapter(){
    List<BrandData> data = new ArrayList<>();
    for(int i = 0; i < 20; i++){
        BrandData brand = new BrandData("brand " + i);
        data.add(brand);
    }

    GridLayoutManager manager = new GridLayoutManager(this, 3, GridLayoutManager.VERTICAL, false);
    manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
        @Override
        public int getSpanSize(int position) {
            if(position == 1 || position == 2){
                return 2;
            }
            if(position == 10){
                return 2;
            }
            return 1;
        }
    });
    mBrandRecyclerView.setLayoutManager(manager);

    mMyAdapter = new VerticalAdapter(data);
    mBrandRecyclerView.setAdapter(mMyAdapter);


    int verticalSpace = Utils.dip2px(this, 15);
    int horizontalSpace = Utils.dip2px(this, 25);
    SparseArray<SCommonItemDecoration.ItemDecorationProps> propMap = new SparseArray<>();
    SCommonItemDecoration.ItemDecorationProps prop1 =
            new SCommonItemDecoration.ItemDecorationProps(horizontalSpace, verticalSpace, true, true);
    propMap.put(VerticalAdapter.TYPE_1, prop1);

    verticalSpace = Utils.dip2px(this, 5);
    horizontalSpace = Utils.dip2px(this, 5);
    SCommonItemDecoration.ItemDecorationProps prop2 =
            new SCommonItemDecoration.ItemDecorationProps(horizontalSpace, verticalSpace, true, true);
    propMap.put(VerticalAdapter.TYPE_2, prop2);
    mBrandRecyclerView.addItemDecoration(new SCommonItemDecoration(propMap));
}
 
开发者ID:ibosong,项目名称:CommonItemDecoration,代码行数:40,代码来源:VerticalGridRecyclerActivity.java

示例2: MonthTimeViewHolder

public MonthTimeViewHolder(View itemView , Context context)
{
    super(itemView);
    this.context = context;
    plan_time_recycler_content = (RecyclerView) itemView.findViewById(R.id.plan_time_recycler_content);
    plan_time_txt_month = (TextView) itemView.findViewById(R.id.plan_time_txt_month);

    RecyclerView.LayoutManager layoutManager = new GridLayoutManager(context, 7 , GridLayoutManager.VERTICAL, false);
    plan_time_recycler_content.setLayoutManager(layoutManager);
}
 
开发者ID:z13538657403,项目名称:CalendarChoose,代码行数:10,代码来源:MonthTimeViewHolder.java

示例3: onViewCreated

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    cartoon_type = getArguments().getInt("classid");
    //判断网络部分
    NetworkInfo netIntfo = null;
    Activity act = (Activity) getContext();
    try {
        ConnectivityManager cm = (ConnectivityManager) getActivity().getSystemService(act.CONNECTIVITY_SERVICE);
        netIntfo = cm.getActiveNetworkInfo();
    } catch (Exception e) {
        Toast.makeText(act, "没有网络权限,请给予相关权限", Toast.LENGTH_SHORT).show();
    }
    if (netIntfo == null) {
        return;
    }
    //初始化布局
    mrecyclerView = (RecyclerView) view.findViewById(R.id.recycler_homepager);
    mgridLayoutManager = new GridLayoutManager(getContext(), 3, GridLayoutManager.VERTICAL, false);
    mrecyclerView.setLayoutManager(mgridLayoutManager);
    swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.grid_swipe_refresh);
    // 这句话是为了,第一次进入页面的时候显示加载进度条
    swipeRefreshLayout.setProgressViewOffset(false, 0, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));
    mAdapter = null;
    isPrepared = true;
    isFirstLoad = true;
    lazyLoad();

    //   new GetData().execute(MainActivity.URL_PREFIX+"/hot?page="+page);
    setListener(); //设置监听事件
}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:31,代码来源:ContentHomeFragment.java

示例4: initWidget

private void initWidget() {
    cartoon_intro_img_blur = (ImageView) findViewById(R.id.cartoon_intro_img_blur);
    cartoon_intro_img_original = (ImageView) findViewById(R.id.cartoon_intro_img_original);
    cartoon_intro_itsname = (TextView) findViewById(R.id.cartoon_intro_itsname);
    cartoon_intro_authorname = (TextView) findViewById(R.id.cartoon_intro_authorname);
    cartoon_intro_itstype = (TextView) findViewById(R.id.cartoon_intro_itstype);
    cartoon_intro_itsdescript = (TextView) findViewById(R.id.cartoon_intro_itsdescript);
    btn_cartooninfo_collect = (Button) findViewById(R.id.btn_cartooninfo_collect);
    btn_cartooninfo_beginread = (Button) findViewById(R.id.btn_cartooninfo_beginread);
    ic_text_download = (TextView) findViewById(R.id.ic_text_download);
    ic_text_getsource = (TextView) findViewById(R.id.ic_text_getsource);
    recycler_singlecartoon = (RecyclerView) findViewById(R.id.recycler_singlecartoon);
    mgridLayoutManager = new GridLayoutManager(getApplicationContext(), 4 ,GridLayoutManager.VERTICAL,false);
    recycler_singlecartoon.setLayoutManager(mgridLayoutManager);

    //设置图标字体
    Typeface iconfont = Typeface.createFromAsset(getAssets(),"font_w27n7ly31ae5ewmi/iconfont.ttf");
    ic_text_download.setTypeface(iconfont);
    ic_text_download.setText("\ue62a");
    ic_text_getsource.setTypeface(iconfont);
    ic_text_getsource.setText("\ue690");

    if (UserPreference.isLogin()){
        userId = UserPreference.read(Constant.IS_USER_ID, null);
    }else {
        userId = "1";
    }

}
 
开发者ID:ligongzai,项目名称:QianXun,代码行数:29,代码来源:CartoonIntro.java

示例5: initRecycler

public void initRecycler(View view, Context context) {
    rvLabel = view.findViewById(R.id.rv_label_choose);
    adapter = new LabelChooseAdapter(Constant.videoTypeList, Constant.LabelMap, context);
    adapter.setItemClickListener(new LabelChooseAdapter.ItemClickListener() {
        @Override
        public void itemClick(String labelType) {
            mListener.ItemClick(labelType);
        }
    });
    GridLayoutManager layoutManager = new GridLayoutManager(context, 3, GridLayoutManager.VERTICAL, false);
    rvLabel.setLayoutManager(layoutManager);
    rvLabel.setAdapter(adapter);
}
 
开发者ID:monkeywiiu,项目名称:Discover,代码行数:13,代码来源:MyPopupWindow.java

示例6: initUI

public void initUI() {
    ActionBar actionBar = this.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    int numOfColumns = Utils.calculateNoOfColumns(this) + 2;

    appsContainer = (LinearLayout) findViewById(R.id.frame_all_top);
    rvAllApps = (RecyclerView) findViewById(R.id.rv_all_apps);
    GridLayoutManager gridLayoutManager =
            new GridLayoutManager(this, numOfColumns, GridLayoutManager.VERTICAL, false);
    rvAllApps.setLayoutManager(gridLayoutManager);
}
 
开发者ID:Existentio,项目名称:OddLauncher,代码行数:14,代码来源:AllAppsActivity.java

示例7: initUI

public void initUI() {
//        searchText = (EditText) findViewById(R.id.search_bar_default);
        frameContainer = (LinearLayout) findViewById(R.id.frame_default);
        flSearch = (FrameLayout) findViewById(R.id.frame_default_search);
        rvDefault = (RecyclerView) findViewById(R.id.list_view_default);
        GridLayoutManager gridLayoutManager =
                new GridLayoutManager(this, 2, GridLayoutManager.VERTICAL, false);
        rvDefault.setLayoutManager(gridLayoutManager);

        layoutManager = new GridLayoutManager(this, 2, GridLayoutManager.VERTICAL, false);

    }
 
开发者ID:Existentio,项目名称:OddLauncher,代码行数:12,代码来源:DefaultAppsActivity.java

示例8: AppsGridLayoutManager

AppsGridLayoutManager(Context context) {
    super(context, 1, GridLayoutManager.VERTICAL, false);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:3,代码来源:AllAppsGridAdapter.java

示例9: getLayoutManagerManager

@Override
protected RecyclerView.LayoutManager getLayoutManagerManager() {
    return new GridLayoutManagerExt(this, 3, GridLayoutManager.VERTICAL, false);
}
 
开发者ID:littleloulou,项目名称:PullToRefreshRecyclerView,代码行数:4,代码来源:GridLayoutActivity.java

示例10: AppsGridLayoutManager

public AppsGridLayoutManager(Context context) {
    super(context, 1, GridLayoutManager.VERTICAL, false);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:3,代码来源:AllAppsGridAdapter.java

示例11: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_ACTION_BAR);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mParticipantsGrid = (RecyclerView) findViewById(R.id.grid_container);
    mLayoutManager = new GridLayoutManager(this, 2, GridLayoutManager.VERTICAL, false);
    setupMultipartyLayout();
    mParticipantsGrid.setLayoutManager(mLayoutManager);
    try {
        mParticipantsAdapter = new ParticipantsAdapter(MainActivity.this, mParticipantsList, MainActivity.this);
        if (mParticipantsAdapter != null) {
            mParticipantsGrid.setAdapter(mParticipantsAdapter);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    mWebViewContainer = (WebView) findViewById(R.id.webview);
    mAlert = (TextView) findViewById(R.id.quality_warning);
    mScreenSharingContainer = (RelativeLayout) findViewById(R.id.screensharing_container);
    mActionBarContainer = (RelativeLayout) findViewById(R.id.actionbar_fragment_container);
    mTextChatContainer = (FrameLayout) findViewById(R.id.textchat_fragment_container);

    mAnnotationsToolbar = (AnnotationsToolbar) findViewById(R.id.annotations_bar);

    mCallToolbar = (TextView) findViewById(R.id.call_toolbar);

    //request Marshmallow camera permission
    if (ContextCompat.checkSelfPermission(this, permissions[1]) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(this, permissions[0]) != PackageManager.PERMISSION_GRANTED) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            requestPermissions(permissions, permsRequestCode);
        }
    } else {
        mVideoPermission = true;
        mAudioPermission = true;
        mWriteExternalStoragePermission = true;
        mReadExternalStoragePermission = true;
    }

    //init the sdk wrapper
    OTConfig config =
            new OTConfig.OTConfigBuilder(OpenTokConfig.SESSION_ID, OpenTokConfig.TOKEN, OpenTokConfig.API_KEY).name("accelerator-sample-app").subscribeAutomatically(true).subscribeToSelf(false).build();

    mWrapper = new OTWrapper(MainActivity.this, config);

    //set listener to receive the communication events, and add UI to these events
    mWrapper.addBasicListener(mBasicListener);
    mWrapper.addAdvancedListener(mAdvancedListener);
    //use a custom video renderer for the annotations. It will be applied to the remote. It will be applied before to start subscribing
    mRemoteRenderer = new AnnotationsVideoRenderer(this);
    mScreensharingRenderer = new AnnotationsVideoRenderer(this);
    mWrapper.setRemoteVideoRenderer(mRemoteRenderer, true);

    //connect
    if (mWrapper != null) {
        mWrapper.connect();
    }

    //show connections dialog
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setTitle("Please wait");
    mProgressDialog.setMessage("Connecting...");
    mProgressDialog.show();

    //init controls fragments
    if (savedInstanceState == null) {
        mFragmentTransaction = getSupportFragmentManager().beginTransaction();
        initActionBarFragment(); //to enable/disable local media
        initTextChatFragment(); //to send/receive text-messages
        mFragmentTransaction.commitAllowingStateLoss();
    }

    //get orientation
    mOrientation = getResources().getConfiguration().orientation;
}
 
开发者ID:opentok,项目名称:accelerator-sample-apps-android,代码行数:79,代码来源:MainActivity.java

示例12: initView

private void initView(){
    coordinatorLayout=(CoordinatorLayout)findViewById(R.id.grid_coordinatorLayout);

    recyclerview=(RecyclerView)findViewById(R.id.grid_recycler);
    mLayoutManager=new GridLayoutManager(GridActivity.this,3,GridLayoutManager.VERTICAL,false);
    recyclerview.setLayoutManager(mLayoutManager);

    swipeRefreshLayout=(SwipeRefreshLayout) findViewById(R.id.grid_swipe_refresh) ;
    //调整SwipeRefreshLayout的位置
    swipeRefreshLayout.setProgressViewOffset(false, 0,  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, getResources().getDisplayMetrics()));


}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:GridActivity.java

示例13: orientation

/**
 * Get the orientation to lay out this fragment.
 *
 * @return the orientation to lay out this fragment.
 */
public int orientation() {
    return GridLayoutManager.VERTICAL;
}
 
开发者ID:wayfair,项目名称:brickkit-android,代码行数:8,代码来源:BrickFragment.java


注:本文中的android.support.v7.widget.GridLayoutManager.VERTICAL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。