com.alibaba.android.vlayout.layout.StickyLayoutHelper Java Examples
The following examples show how to use
com.alibaba.android.vlayout.layout.StickyLayoutHelper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DebugActivity.java From vlayout with MIT License | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); RecyclerView recyclerView = (RecyclerView)findViewById(R.id.main_view); VirtualLayoutManager virtualLayoutManager = new VirtualLayoutManager(this); DelegateAdapter delegateAdapter = new DelegateAdapter(virtualLayoutManager); List<Adapter> adapterList = new ArrayList<>(); adapterList.add(new SubAdapter(new LinearLayoutHelper(20), 20)); adapterList.add(new SubAdapter(new StickyLayoutHelper(true), 1)); adapterList.add(new SubAdapter(new LinearLayoutHelper(20), 20)); adapterList.add(new SubAdapter(new GridLayoutHelper(4), 80)); // adapterList.add(new SubAdapter(new FixLayoutHelper(0, 0), 1)); adapterList.add(new SubAdapter(new FixLayoutHelper(TOP_RIGHT, 0, 0), 1)); delegateAdapter.addAdapters(adapterList); recyclerView.setLayoutManager(virtualLayoutManager); recyclerView.setAdapter(delegateAdapter); }
Example #2
Source File: VLayoutFragment.java From AndroidSamples with Apache License 2.0 | 5 votes |
private void initSticky() { StickyLayoutHelper layoutHelper = new StickyLayoutHelper(); // 设置偏移量(距离顶部或底部) // layoutHelper.setOffset(100); // 宽与高的比例 // layoutHelper.setAspectRatio(4); // layoutHelper.setBgColor(0xFFF5A623); adapters.add(new SubAdapter(mContext, layoutHelper, 1) { @Override public int getItemViewType(int position) { return 3; } }); }