本文整理匯總了Java中com.eowise.recyclerview.stickyheaders.StickyHeadersBuilder類的典型用法代碼示例。如果您正苦於以下問題:Java StickyHeadersBuilder類的具體用法?Java StickyHeadersBuilder怎麽用?Java StickyHeadersBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StickyHeadersBuilder類屬於com.eowise.recyclerview.stickyheaders包,在下文中一共展示了StickyHeadersBuilder類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initViews
import com.eowise.recyclerview.stickyheaders.StickyHeadersBuilder; //導入依賴的package包/類
private void initViews() {
// mSearchKeyEditText.setHint(R.string.caption_input_brand_name);
mTitleView.setText("選擇汽車品牌");
mRightView.setVisibility(View.GONE);
if (mUserCarInfo != null) {
mRightView.setVisibility(View.VISIBLE);
mRightView.setText("刪除");
} else {
mRightView.setVisibility(View.GONE);
}
mCarBrandRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mCatalogAdapter = new LetterCatalogAdapter();
mCatalogRecyclerView.setLayoutManager(new GridLayoutManager(this, 7));
int spacingInPixels = getResources().getDimensionPixelSize(R.dimen.spacing_10);
mCatalogRecyclerView.addItemDecoration(new GridSpacingItemDecoration(spacingInPixels));
mCatalogRecyclerView.setAdapter(mCatalogAdapter);
mCacheCarBrands = CarBrandRepo.getCacheCarBrands();
if (mCacheCarBrands != null) {
mCarBrands.addAll(mCacheCarBrands);
}
mCarBrandAdapter = new CarBrandAdapter(mCarBrands);
mCarBrandAdapter.setOnItemClickListener(this);
mCarBrandAdapter.setHasStableIds(true);
mHeader = new StickyHeadersBuilder()
.setAdapter(mCarBrandAdapter)
.setRecyclerView(mCarBrandRecyclerView)
.setStickyHeadersAdapter(new InitialHeaderAdapter(mCarBrands))
.build();
mCarBrandRecyclerView.setAdapter(mCarBrandAdapter);
mCarBrandRecyclerView.addItemDecoration(mHeader);
}
示例2: buildHeaderDecor
import com.eowise.recyclerview.stickyheaders.StickyHeadersBuilder; //導入依賴的package包/類
private StickyHeadersItemDecoration buildHeaderDecor() {
return new StickyHeadersBuilder()
.setAdapter(mListAdapter)
.setRecyclerView(mRecyclerView)
.setStickyHeadersAdapter(new FontListHeaderAdapter(mFontList), true)
.build();
}
示例3: initView
import com.eowise.recyclerview.stickyheaders.StickyHeadersBuilder; //導入依賴的package包/類
private void initView() {
searchView = new MySearchView(this);
searchView.setQueryHint(getResources().getString(R.string.search_hint));
searchView.setOnQueryTextListener(query -> {
dialog.show();
searchView.clearFocus();
Single.defer(() -> ZhihuDailyPurifyServer.searchForKeyword(query))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this);
return true;
});
RelativeLayout relative = new RelativeLayout(this);
relative.addView(searchView);
toolbar.addView(relative);
setSupportActionBar(toolbar);
Optional.ofNullable(getSupportActionBar())
.ifPresent(ab -> ab.setDisplayHomeAsUpEnabled(true));
RecyclerView recyclerView = findViewById(R.id.search_result_list);
recyclerView.setHasFixedSize(true);
LinearLayoutManager llm = new LinearLayoutManager(this);
llm.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(llm);
adapter = new NewsAdapter();
headerAdapter = new DateHeaderAdapter();
StickyHeadersItemDecoration header = new StickyHeadersBuilder()
.setAdapter(adapter)
.setRecyclerView(recyclerView)
.setStickyHeadersAdapter(headerAdapter)
.build();
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(header);
}