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


Java RecyclerView.ItemDecoration方法代碼示例

本文整理匯總了Java中android.support.v7.widget.RecyclerView.ItemDecoration方法的典型用法代碼示例。如果您正苦於以下問題:Java RecyclerView.ItemDecoration方法的具體用法?Java RecyclerView.ItemDecoration怎麽用?Java RecyclerView.ItemDecoration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.widget.RecyclerView的用法示例。


在下文中一共展示了RecyclerView.ItemDecoration方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_completed_tasks);
    Toolbar toolbarCompletedTasks = (Toolbar) findViewById(R.id.toolbar_task_completed);
    setSupportActionBar(toolbarCompletedTasks);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mRecyclerView = (RecyclerView)findViewById(R.id.recyclerView_completed);
    mTextEmptyList = (TextView) findViewById(R.id.text_noTask);

    mLayoutManager = new LinearLayoutManager(getApplicationContext());
    mDbHelper = new DBHelper(getApplicationContext());
    mCompletedList = new ArrayList<>();
    mAdapter = new CompletedTasksAdapter(mCompletedList,CompletedTasksActivity.this);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(mLayoutManager);
    RecyclerView.ItemDecoration itemDecoration = new
            DividerItemDecoration(this,DividerItemDecoration.VERTICAL);
    mRecyclerView.addItemDecoration(itemDecoration);
    setClickListeners();

    //Load all saved Tasks
    new LoadCompletedTasks().execute();
}
 
開發者ID:swapyx,項目名稱:Channelize,代碼行數:27,代碼來源:CompletedTasksActivity.java

示例2: onCreateView

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    view = inflater.inflate(R.layout.fragment_task_list, container, false);

    mTextEmptyList = (TextView) view.findViewById(R.id.text_empty_list);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView_main);
    mFab = (FloatingActionButton) view.findViewById(R.id.fab_add);

    mLayoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setLayoutManager(mLayoutManager);
    RecyclerView.ItemDecoration itemDecoration = new
            DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL);
    mRecyclerView.addItemDecoration(itemDecoration);

    setClickListeners();
    setupBroadcastReceiver();

    return view;
}
 
開發者ID:swapyx,項目名稱:Channelize,代碼行數:24,代碼來源:TaskListFragment.java

示例3: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
//        Log.i("HabitUpDEBUG", "ViewHabitEventActivity onCreate");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_events);
        events = new ArrayList<>();
        eventListView = (RecyclerView) findViewById(R.id.event_list);
        eventListView.setHasFixedSize(true);

        RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setAutoMeasureEnabled(true);
        eventListView.setLayoutManager(layoutManager);

        RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);
        eventListView.addItemDecoration(itemDecoration);
    }
 
開發者ID:CMPUT301F17T29,項目名稱:HabitUp,代碼行數:17,代碼來源:ViewHabitEventActivity.java

示例4: onCreate

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_grid_layout);
    Intent intent = getIntent();
    final int type = intent.getIntExtra(TYPE, 0);
    final int left = intent.getIntExtra(LEFT, 0);
    final int top = intent.getIntExtra(TOP, 0);
    final int right = intent.getIntExtra(RIGHT, 0);
    final int bottom = intent.getIntExtra(BOTTOM, 0);
    @Orientation final int orientation = intent.getIntExtra(ORIENTATION, LinearLayout.VERTICAL);
    recyclerview = (RecyclerView) findViewById(R.id.recyclerview);
    List<String> strings = Arrays.asList(MainActivity.getList());
    RecyclerViewAdapter adapter = new RecyclerViewAdapter(strings.subList(1, strings.size()), orientation == LinearLayoutManager.HORIZONTAL);
    RecyclerView.ItemDecoration itemDecoration;
    if (type == SPACE) {
        itemDecoration = new GridLayoutSpaceItemDecoration.Builder()
                .build();
    } else if (type == DIVIDER) {
        itemDecoration = new GridLayoutDividerItemDecoration.Builder()
                .setDividerColor(Color.RED)
                .setLeftMargin(left)
                .setTopMargin(top)
                .setRightMargin(right)
                .setBottomMargin(bottom)
                .build();
    } else {
        itemDecoration = new GridLayoutDividerItemDecoration.Builder()
                .setLeftMargin(left)
                .setDividerDrawable(getResources().getDrawable(R.drawable.red2blue))
                .setTopMargin(top)
                .setRightMargin(right)
                .setBottomMargin(bottom)
                .build();
    }
    recyclerview.setLayoutManager(new GridLayoutManager(this, 3, orientation, false));
    recyclerview.addItemDecoration(itemDecoration);
    recyclerview.setAdapter(adapter);
}
 
開發者ID:crazysunj,項目名稱:RecycylerViewItemDecoration,代碼行數:40,代碼來源:GridLayoutActivity.java

示例5: addItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void addItemDecoration(RecyclerView.ItemDecoration decor) {
    recyclerView.addItemDecoration(decor);
}
 
開發者ID:sswukang,項目名稱:RvAdapter,代碼行數:4,代碼來源:SideAndStickyHeaderRecyclerView.java

示例6: removeItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void removeItemDecoration(RecyclerView.ItemDecoration decor) {
    recyclerView.removeItemDecoration(decor);
}
 
開發者ID:jonashao,項目名稱:Samantha,代碼行數:4,代碼來源:RealmRecyclerView.java

示例7: showTrackedCoins

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
@Override
public void showTrackedCoins(PriceMultiFull priceMultiFull) {
    PriceMultiFull price = priceMultiFull;
    HashMap display = priceMultiFull.getDISPLAY();
    ArrayList<DisplayPrice> displayPrices = new ArrayList<>();
    ArrayList<RawPrice> rawPrices = new ArrayList<>();
    RecyclerView.ItemDecoration dividerItemDecoration =
            new RVDividerItemDecoration(ContextCompat.getDrawable(this,
                    R.drawable.bg_rv_separator));

    if (display.size() > 0) {
        displayPrices = priceMultiFull.getDisplayPrices();
        rawPrices = priceMultiFull.getRawPrices();

        myCoinsAdapter = new MyCoinsAdapter(this, displayPrices, rawPrices, this);
        layoutManager = new LinearLayoutManager(this);
        ScaleInAnimator animator = new ScaleInAnimator();
        animator.setChangeDuration(2000);
        rvMyCoins.setAdapter(myCoinsAdapter);
        rvMyCoins.setLayoutManager(layoutManager);
        rvMyCoins.setNestedScrollingEnabled(false);
        rvMyCoins.setItemAnimator(animator);

        if (!isRefreshUserCoins) {
            // add item decoration only once
            rvMyCoins.addItemDecoration(dividerItemDecoration);
        } else {
            isRefreshUserCoins = false;
        }

        if (isCoinAdded) {
            Alerter.create(this)
                    .setTitle("Your coin(s) have been added")
                    .setBackgroundColorRes(R.color.colorPositiveNotification)
                    .setIcon(R.drawable.ic_thumbs_up_o)
                    .setDuration(2000)
                    .show();
            isCoinAdded = false;
        }
    } else {
        // TODO show meaningful error
    }
}
 
開發者ID:mayuroks,項目名稱:Coin-Tracker,代碼行數:44,代碼來源:HomeActivity.java

示例8: removeItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void removeItemDecoration(RecyclerView.ItemDecoration itemDecoration) {
    mRecycler.removeItemDecoration(itemDecoration);
}
 
開發者ID:zwmlibs,項目名稱:BookReader-master,代碼行數:4,代碼來源:EasyRecyclerView.java

示例9: addItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void addItemDecoration(RecyclerView.ItemDecoration itemDecoration, int index) {
    mRecycler.addItemDecoration(itemDecoration, index);
}
 
開發者ID:ynztlxdeai,項目名稱:TextReader,代碼行數:4,代碼來源:EasyRecyclerView.java

示例10: createItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
protected RecyclerView.ItemDecoration createItemDecoration() {
    return null;
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:4,代碼來源:UIRecyclerUIView.java

示例11: addItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void addItemDecoration(RecyclerView.ItemDecoration itemDecoration) {
        if (itemDecoration != null) {
                display.addItemDecoration(itemDecoration);
        }
}
 
開發者ID:HelloChenJinJun,項目名稱:TestChat,代碼行數:6,代碼來源:MultiFuncRecyclerView.java

示例12: addItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void addItemDecoration(RecyclerView.ItemDecoration decor) {
    mRecyclerView.addItemDecoration(decor);
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:4,代碼來源:PullLoadMoreRecyclerView.java

示例13: getItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
protected RecyclerView.ItemDecoration getItemDecoration() {
    return new DividerItemDecoration(getApplicationContext(), R.drawable.list_divider);
}
 
開發者ID:AnnyBaby,項目名稱:Mvp-Retrofit-Rxjava-Rxbus,代碼行數:4,代碼來源:BaseListActivity.java

示例14: getItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
/**
 * Returns the item decoration for the recycler view.
 */
public RecyclerView.ItemDecoration getItemDecoration() {
    // We don't draw any headers when we are uncomfortably dense
    return mItemDecoration;
}
 
開發者ID:michelelacorte,項目名稱:FlickLauncher,代碼行數:8,代碼來源:AllAppsGridAdapter.java

示例15: addItemDecoration

import android.support.v7.widget.RecyclerView; //導入方法依賴的package包/類
public void addItemDecoration(RecyclerView.ItemDecoration itemDecoration) {
    mRecyclerView.addItemDecoration(itemDecoration);
}
 
開發者ID:Tamicer,項目名稱:FastDownloader,代碼行數:4,代碼來源:PracticalRecyclerView.java


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