本文整理汇总了Java中android.support.v7.widget.DividerItemDecoration.setDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java DividerItemDecoration.setDrawable方法的具体用法?Java DividerItemDecoration.setDrawable怎么用?Java DividerItemDecoration.setDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.DividerItemDecoration
的用法示例。
在下文中一共展示了DividerItemDecoration.setDrawable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpRecyclerView
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
private void setUpRecyclerView() {
mLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
mAdapter = new AttachmentAdapter(getActivity(), mTask.getAttachments(), false);
mAdapter.setShowAttachmentHintListener(new AttachmentAdapter.ShowAttachmentHintListener() {
@Override
public void onShowAttachmentHint() {
if (!mAttachmentLongClickOptionsDialogHintShown) {
mAttachmentLongClickOptionsDialogHintShown = true;
SnackbarUtil.showSnackbar(mContainer, SnackbarUtil.SnackbarType.NOTICE, R.string.fragment_task_snackbar_notice_attachments_options_hint, SnackbarUtil.SnackbarDuration.LONG, null);
}
}
});
DividerItemDecoration itemDecoration = new DividerItemDecoration(getActivity(), mLayoutManager.getOrientation());
itemDecoration.setDrawable(ContextCompat.getDrawable(getActivity(), R.drawable.item_decoration_half_line));
mRecyclerView.setNestedScrollingEnabled(false);
mRecyclerView.addItemDecoration(itemDecoration);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
}
示例2: setUpRecyclerView
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
private void setUpRecyclerView() {
if(mTask.getAttachments().size() > 0) {
mAttachmentsSubtitle.setVisibility(View.VISIBLE);
mLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
mAdapter = new AttachmentAdapter(this, mTask.getAttachments(), true);
mAdapter.setAttachmentDataUpdatedListener(new AttachmentAdapter.AttachmentDataUpdatedListener() {
@Override
public void onAttachmentDataUpdated() {
mTaskDataUpdated = true;
}
});
DividerItemDecoration itemDecoration = new DividerItemDecoration(this, mLayoutManager.getOrientation());
itemDecoration.setDrawable(ContextCompat.getDrawable(this, R.drawable.item_decoration_half_line));
mRecyclerView.addItemDecoration(itemDecoration);
mRecyclerView.setNestedScrollingEnabled(false);
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setAdapter(mAdapter);
}
}
示例3: initWidget
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
protected void initWidget(View root) {
super.initWidget(root);
TextView textView =findView(R.id.toolbar_title);
textView.setText(R.string.tab_name_video_list);
mRecyclerView = findView(R.id.pull_recycler_view);
// 初始化PullRecyclerView
mLayoutManager = new XLinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
DividerItemDecoration itemDecoration = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
itemDecoration.setDrawable(getResources().getDrawable(R.drawable.shape_simple_item_decoration));
mRecyclerView.addItemDecoration(itemDecoration);
mAdpater = new VideoListAdpater(getContext(), R.layout.lay_item_video_file, new ArrayList<VideoInfo>(),getFragmentManager());
mRecyclerView.setAdapter(mAdpater);
mRecyclerView.enablePullRefresh(true); // 开启下拉刷新,默认即为true,可不用设置
mRecyclerView.enableLoadMore(false);
mRecyclerView.setOnRecyclerRefreshListener(this);
}
示例4: initView
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
protected void initView(View view) {
bind = DataBindingUtil.bind(view);
// init recycler view
homeAdapter = new HomeAdapter(new ArrayList<ProjectBean>(0));
bind.rv.setAdapter(homeAdapter);
bind.rv.setLayoutManager(new LinearLayoutManager(getContext()));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
dividerItemDecoration.setDrawable(getResources().getDrawable(R.drawable.shape_drive_line));
bind.rv.addItemDecoration(dividerItemDecoration);
initEvent();
}
示例5: initView
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
protected void initView(View view) {
bind = DataBindingUtil.bind(view);
// init recycler view
findAdapter = new FindAdapter(new ArrayList<ProjectBean>(0));
bind.rv.setAdapter(findAdapter);
bind.rv.setLayoutManager(new LinearLayoutManager(getContext()));
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
dividerItemDecoration.setDrawable(getResources().getDrawable(R.drawable.shape_drive_line));
bind.rv.addItemDecoration(dividerItemDecoration);
initEvent();
}
示例6: onCreateView
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_blocks, container, false);
tvStatus = (TextView) rootView.findViewById(R.id.tvStatus);
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
DividerItemDecoration horizontalDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
DividerItemDecoration.VERTICAL);
Drawable horizontalDivider = ContextCompat.getDrawable(getActivity(), R.drawable.divider_grey);
horizontalDecoration.setDrawable(horizontalDivider);
mRecyclerView.addItemDecoration(horizontalDecoration);
// specify an adapter (see also next example)
mAdapter = new BlocksAdapter(blocks);
mAdapter.setOnItemClickListener(this);
mRecyclerView.setAdapter(mAdapter);
refreshUI();
return rootView;
}
示例7: checkForNewUpdates
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
public void checkForNewUpdates(int opt) {
SimpleDateFormat entireDate = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
String localEntireDate = entireDate.format(new Date());
//Log.i("activities", "Local date is "+localEntireDate);
DatabaseHandler databaseHandler = new DatabaseHandler(this);
listLogsPrevious = databaseHandler.getActivities(getIntent().getStringExtra(userPhoneNumber));
databaseHandler.close();
if(listLogsPrevious != null && opt == 0) {
String fetchDate = listLogsPrevious.get(0).getDate();
if(!localEntireDate.equals(fetchDate))
textView.setText(coolDateString(fetchDate));
else
textView.setText(R.string.today);
activitiesAdapter = new ActivitiesAdapter(this, listLogsPrevious);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(activitiesAdapter);
//For adding dividers in the list
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(recyclerView.getContext(), linearLayoutManager.getOrientation());
dividerItemDecoration.setDrawable(ContextCompat.getDrawable(activity, R.drawable.line_divider));
recyclerView.addItemDecoration(dividerItemDecoration);
}
getActivitiesOfUser(getIntent().getStringExtra(userPhoneNumber), localEntireDate, textView);
}
示例8: onCreateView
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_peers, container, false);
tvStatus = (TextView) rootView.findViewById(R.id.tvStatus);
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
DividerItemDecoration horizontalDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
DividerItemDecoration.VERTICAL);
Drawable horizontalDivider = ContextCompat.getDrawable(getActivity(), R.drawable.divider_grey);
horizontalDecoration.setDrawable(horizontalDivider);
mRecyclerView.addItemDecoration(horizontalDecoration);
// specify an adapter (see also next example)
mAdapter = new PeersAdapter(reverseDnsLookups);
mAdapter.setOnItemClickListener(this);
mRecyclerView.setAdapter(mAdapter);
refreshUI();
return rootView;
}
示例9: onCreate
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_saved_toot);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar bar = getSupportActionBar();
if (bar != null) {
bar.setTitle(getString(R.string.title_saved_toot));
bar.setDisplayHomeAsUpEnabled(true);
bar.setDisplayShowHomeEnabled(true);
}
RecyclerView recyclerView = findViewById(R.id.recycler_view);
noContent = findViewById(R.id.no_content);
recyclerView.setHasFixedSize(true);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
DividerItemDecoration divider = new DividerItemDecoration(
this, layoutManager.getOrientation());
Drawable drawable = ThemeUtils.getDrawable(this, R.attr.status_divider_drawable,
R.drawable.status_divider_dark);
divider.setDrawable(drawable);
recyclerView.addItemDecoration(divider);
adapter = new SavedTootAdapter(this);
recyclerView.setAdapter(adapter);
}
示例10: onCreate
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_items);
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
DividerItemDecoration horizontalDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
DividerItemDecoration.VERTICAL);
Drawable horizontalDivider = ContextCompat.getDrawable(this, R.drawable.divider_grey);
horizontalDecoration.setDrawable(horizontalDivider);
mRecyclerView.addItemDecoration(horizontalDecoration);
// specify an adapter (see also next example)
mAdapter = new ItemAdapter(mDataset);
mRecyclerView.setAdapter(mAdapter);
try {
getTx();
} catch (Exception e) {
e.printStackTrace();
}
}
示例11: onCreate
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_items);
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
// use this setting to improve performance if you know that changes
// in content do not change the layout size of the RecyclerView
mRecyclerView.setHasFixedSize(true);
// use a linear layout manager
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
DividerItemDecoration horizontalDecoration = new DividerItemDecoration(mRecyclerView.getContext(),
DividerItemDecoration.VERTICAL);
Drawable horizontalDivider = ContextCompat.getDrawable(this, R.drawable.divider_grey);
horizontalDecoration.setDrawable(horizontalDivider);
mRecyclerView.addItemDecoration(horizontalDecoration);
// specify an adapter (see also next example)
mAdapter = new ItemAdapter(mDataset);
mAdapter.setOnItemClickListener(this);
mRecyclerView.setAdapter(mAdapter);
setStatusPending();
try {
getBlock();
} catch (Exception e) {
e.printStackTrace();
}
}
示例12: setUpAdapterAndView
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
/**
* In order to make sure things execute in the proper order, we have our Controller tell the
* View when to set up it's stuff.
*
* @param listOfData
*/
@Override
public void setUpAdapterAndView(List<ListItem> listOfData) {
this.listOfData = listOfData;
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(layoutManager);
adapter = new CustomAdapter();
recyclerView.setAdapter(adapter);
DividerItemDecoration itemDecoration = new DividerItemDecoration(
recyclerView.getContext(),
layoutManager.getOrientation()
);
itemDecoration.setDrawable(
ContextCompat.getDrawable(
ListActivity.this,
R.drawable.divider_white
)
);
recyclerView.addItemDecoration(
itemDecoration
);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(createHelperCallback());
itemTouchHelper.attachToRecyclerView(recyclerView);
}
示例13: createItemDecoration
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
private DividerItemDecoration createItemDecoration(int orientation) {
Drawable mDivider = ContextCompat.getDrawable(getContext(), R.drawable.cell_line_divider);
// That means; There is a custom separator color from user.
if (m_nSeparatorColor != -1) {
// Change its color
mDivider.setColorFilter(m_nSeparatorColor, PorterDuff.Mode.SRC_ATOP);
}
DividerItemDecoration jItemDecoration = new DividerItemDecoration(getContext(),
orientation);
jItemDecoration.setDrawable(mDivider);
return jItemDecoration;
}
示例14: initWidget
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
@Override
protected void initWidget(View root) {
super.initWidget(root);
mPullRecyclerView = findView(R.id.pull_recycler_view);
mAppBarLayout = findView(R.id.appBarLayout);
mToolbar = findView(R.id.toolbar);
mToolbarTitle = findView(R.id.toolbar_title);
mPullRecyclerView.setOnRecyclerRefreshListener(this);
// 初始化PullRecyclerView
mLayoutManager = new XLinearLayoutManager(getContext());
mPullRecyclerView.setLayoutManager(mLayoutManager);
if (mAdapter != null) {
mPullRecyclerView.setAdapter(mAdapter);
} else {
mAdapter = getListAdapter();
mPullRecyclerView.setAdapter(mAdapter);
}
mPullRecyclerView.setEmptyView(R.layout.lay_empty_view);
mEmptyView = mPullRecyclerView.getAdapter().getEmptyView();
mEmptyBtn = (Button) mEmptyView.findViewById(R.id.empty_view_btn);
mEmptyText = (TextView) mEmptyView.findViewById(R.id.empty_view_ico_tv);
mEmptyView.findViewById(R.id.empty_view_btn).setOnClickListener(this);
mEmptyView.setVisibility(View.GONE);
mPullRecyclerView.setColorSchemeResources(R.color.colorAccent); // 设置下拉刷新的旋转圆圈的颜色
DividerItemDecoration itemDecoration = new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL);
itemDecoration.setDrawable(getResources().getDrawable(R.drawable.shape_simple_item_decoration));
mPullRecyclerView.addItemDecoration(itemDecoration);
mPullRecyclerView.enablePullRefresh(true); // 开启下拉刷新,默认即为true,可不用设置
mPullRecyclerView.enableLoadDoneTip(true, R.string.load_done_tip); // 开启数据全部加载完成时的底部提示,默认为false
}
示例15: setListData
import android.support.v7.widget.DividerItemDecoration; //导入方法依赖的package包/类
public void setListData(List<ListItem> listOfData) {
this.listOfData = listOfData;
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
adapter = new CustomAdapter();
recyclerView.setAdapter(adapter);
DividerItemDecoration itemDecoration = new DividerItemDecoration(
recyclerView.getContext(),
layoutManager.getOrientation()
);
itemDecoration.setDrawable(
ContextCompat.getDrawable(
getActivity(),
R.drawable.divider_white
)
);
recyclerView.addItemDecoration(
itemDecoration
);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(createHelperCallback());
itemTouchHelper.attachToRecyclerView(recyclerView);
}