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


Java DividerItemDecoration.setDrawable方法代碼示例

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

示例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);
        }
    }
 
開發者ID:abicelis,項目名稱:Remindy,代碼行數:23,代碼來源:TaskDetailActivity.java

示例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);
}
 
開發者ID:bigjelly,項目名稱:ShaddockVideoPlayer,代碼行數:20,代碼來源:VideoListFragment.java

示例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();
}
 
開發者ID:ittianyu,項目名稱:POCenter,代碼行數:15,代碼來源:HomeFragment.java

示例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();
}
 
開發者ID:ittianyu,項目名稱:POCenter,代碼行數:15,代碼來源:FindFragment.java

示例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;
}
 
開發者ID:lvaccaro,項目名稱:BitcoinBlockExplorer,代碼行數:32,代碼來源:FragmentBlocks.java

示例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);

    }
 
開發者ID:kunalrmhatre,項目名稱:fussroll,代碼行數:36,代碼來源:ActivitiesActivity.java

示例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;
}
 
開發者ID:lvaccaro,項目名稱:BitcoinBlockExplorer,代碼行數:32,代碼來源:FragmentPeers.java

示例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);
}
 
開發者ID:Vavassor,項目名稱:Tusky,代碼行數:29,代碼來源:SavedTootActivity.java

示例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();
    }
}
 
開發者ID:lvaccaro,項目名稱:BitcoinBlockExplorer,代碼行數:32,代碼來源:TxActivity.java

示例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();
    }
}
 
開發者ID:lvaccaro,項目名稱:BitcoinBlockExplorer,代碼行數:36,代碼來源:BlockActivity.java

示例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);


}
 
開發者ID:BracketCove,項目名稱:RecyclerViewTutorial2017,代碼行數:38,代碼來源:ListActivity.java

示例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;
}
 
開發者ID:evrencoskun,項目名稱:TableView,代碼行數:15,代碼來源:TableView.java

示例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
}
 
開發者ID:bigjelly,項目名稱:ShaddockVideoPlayer,代碼行數:37,代碼來源:BaseListViewFragment.java

示例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);
}
 
開發者ID:BracketCove,項目名稱:RoomDemo2017,代碼行數:30,代碼來源:ListFragment.java


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