当前位置: 首页>>代码示例>>Java>>正文


Java DividerItemDecoration类代码示例

本文整理汇总了Java中android.support.v7.widget.DividerItemDecoration的典型用法代码示例。如果您正苦于以下问题:Java DividerItemDecoration类的具体用法?Java DividerItemDecoration怎么用?Java DividerItemDecoration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DividerItemDecoration类属于android.support.v7.widget包,在下文中一共展示了DividerItemDecoration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_select_language, container, false);
    ButterKnife.bind(this, v);

    mRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecycler.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
    visibleProgress(mProgress, true);
    workAPI.getAllLanguage(new StringListCallback() {
        @Override
        public void onSuccess(@NonNull List<String> stringsList) {
            languages.clear();
            languages.addAll(stringsList);
            actionSelectLanguage();
        }

        @Override
        public void onError(@NonNull Throwable t) {

        }
    });
    return v;
}
 
开发者ID:OlegKlimenko,项目名称:Plamber-Android,代码行数:25,代码来源:SelectLanguageFragamnt.java

示例2: initView

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
public void initView(){
  //initdata();
  poemData = new ArrayList<SongCi>();

  poemRecyclerView = (RecyclerView) cxt.findViewById(R.id.recycler_view);

  poemAdapter = new PoemAdapter(cxt, poemData,poemRecyclerView);
  poemRecyclerView.setAdapter(poemAdapter);//设置适配器
  poemRecyclerView.setVerticalScrollBarEnabled(true);
  //设置布局管理器 , 将布局设置成纵向
  LinearLayoutManager
      linerLayoutManager = new LinearLayoutManager(cxt, LinearLayoutManager.VERTICAL, false);
  poemRecyclerView.setLayoutManager(linerLayoutManager);

  //设置分隔线
  poemRecyclerView.addItemDecoration(new DividerItemDecoration(cxt , DividerItemDecoration.VERTICAL));

  //设置增加或删除条目动画
  poemRecyclerView.setItemAnimator(new DefaultItemAnimator());

}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:22,代码来源:ViewBuilder.java

示例3: setUpAdapter

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
@Override protected void setUpAdapter() {
  if (null != getSupportActionBar()) {
    getSupportActionBar().setDisplayHomeAsUpEnabled(false);
  }

  SampleAdapter sampleAdapter =
      new SampleAdapter(new BaseViewHolder.OnItemClickListener<String>() {
        @Override public void onItemClick(View view, String item) {
          gotoNextActivity(dataList.indexOf(item));
        }
      });

  LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getApplicationContext());
  recyclerView.setLayoutManager(linearLayoutManager);
  recyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
  recyclerView.setAdapter(sampleAdapter);

  sampleAdapter.setDataList(populateData());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:SampleActivity.java

示例4: onCreate

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_recyclerview_test);
        ButterKnife.bind(this);

        LinearLayoutManager layoutManager = new LinearLayoutManager
                (this,LinearLayoutManager.VERTICAL,false);
//        GridLayoutManager gridLayoutManager = new GridLayoutManager(this,2);
//        StaggeredGridLayoutManager staggeredLayoutManager = new StaggeredGridLayoutManager
//                (2,StaggeredGridLayoutManager.VERTICAL);
        recyclerview.setLayoutManager(layoutManager);
        recyclerview.addItemDecoration
                (new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));

//        requestData();
        getRemoteData();



    }
 
开发者ID:BittleDragon,项目名称:MyRepository,代码行数:22,代码来源:RecyclerviewTestActivity.java

示例5: setupRecyclerView

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
private void setupRecyclerView() {
	LinearLayoutManager layoutManager = new LinearLayoutManager(this);
	recyclerView.setLayoutManager(layoutManager);
	recyclerView.addItemDecoration(new DividerItemDecoration(this, layoutManager
			.getOrientation()));
	recyclerView.addOnItemTouchListener(new RecyclerItemClickListener(this, new RecyclerItemClickListener.OnItemClickListener() {
		@Override
		public void onItemClick(View view, int position) {
			Intent intent = new Intent(MainActivity.this, TestViewActivity.class);
			intent.putExtra(TestViewActivity.ARG_TEST_ID, socTests.get(position).getId());
			startActivity(intent);
		}
	}));

	socTests = daoSession.getSocTestDao().loadAll();

	adapter = new TestRecyclerViewAdapter(socTests);
	recyclerView.setAdapter(adapter);
	adapter.notifyDataSetChanged();
}
 
开发者ID:Komdosh,项目名称:SocEltech,代码行数:21,代码来源:MainActivity.java

示例6: initData

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
@Override
public void initData(Bundle savedInstanceState) {
    mViewDataBinding.rvTeam.addItemDecoration(new DividerItemDecoration(getThis(), DividerItemDecoration.VERTICAL));
    mViewDataBinding.rvTeam.setAdapter(mAdapter);
    if (getArguments() != null) {
        int seasion = getArguments().getInt("Seasion ID");
        mSeasionName = getArguments().getString("Seasion Name");
        mViewModel.getResults(seasion).observe(this, new Observer<Resource<List<TeamModel>>>() {
            @Override
            public void onChanged(@Nullable Resource<List<TeamModel>> listResource) {
                mViewDataBinding.setResource(listResource);
                mViewDataBinding.executePendingBindings();
                if (listResource != null && listResource.data != null) {
                    mAdapter.updateData(listResource.data);
                }
            }
        });
    }

}
 
开发者ID:NamTranDev,项目名称:CleanArchitechture,代码行数:21,代码来源:TeamMvvmFragment.java

示例7: showData

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
/**
 * 获取数据
 */
private void showData() {

    List<ShoppingCart> carts = mCartShopProvider.getAll();

    if (carts == null) {
        initEmptyView();           //如果数据为空,显示空的试图
        return;
    }

    /**
     * 购物车数据不为空
     */
    mAdapter = new ShopCartAdapter(getContext(), carts, mCheckBox, mTextTotal);
    mRecyclerView.setAdapter(mAdapter);
    //recyclerView本身存在一个bug,在删 添加数据同时进行时,会报错:
    // java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder
    // adapter positionViewHolder{42319ed8 position=1 id=-1, oldPos=0, pLpos:0 scrap
    // tmpDetached no parent}
    //需要 重写LinearLayoutManager
    mRecyclerView.setLayoutManager(new WrapContentLinearLayoutManager(getContext(),
            LinearLayoutManager.VERTICAL, false));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(),
            DividerItemDecoration.VERTICAL));

}
 
开发者ID:gaolhjy,项目名称:cniao5,代码行数:29,代码来源:ShopCartFragment.java

示例8: showData

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
/**
 * 展示数据
 */
private void showData() {

    if (datas != null && datas.size() > 0) {
        mTxtSummary.setText("共有" + datas.size() + "件商品");
    } else {
        mLlSummary.setVisibility(View.GONE);
        ToastUtils.setGravity(Gravity.CENTER, 0, 0);
        ToastUtils.showShortSafe("暂无商品信息");
        return;
    }

    mAdatper = new HotGoodsAdapter(datas, this);
    mRecyclerview.setAdapter(mAdatper);
    if (actionType == ACTION_LIST) {
        mRecyclerview.setLayoutManager(new LinearLayoutManager(this));
    } else {
        mRecyclerview.setLayoutManager(new GridLayoutManager(this, 2));
    }

    mRecyclerview.setItemAnimator(new DefaultItemAnimator());
    mRecyclerview.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration
            .HORIZONTAL));

}
 
开发者ID:gaolhjy,项目名称:cniao5,代码行数:28,代码来源:GoodsListActivity.java

示例9: onCreateView

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.fragment_artists, container, false);
    ButterKnife.bind(this, rootView);

    adapter = new ListAdapter(getContext(), uiModel);
    adapter.setOnItemClickListener(createOnArtistClickListener());

    artistsView.setHasFixedSize(true);
    artistsView.setAdapter(adapter);
    artistsView.setLayoutManager(new LinearLayoutManager(getContext()));
    artistsView.addItemDecoration(new DividerItemDecoration(getContext(),
            LinearLayoutManager.VERTICAL));

    listHelper = new ListViewHelper(artistsView, emptyListView, loadingProgressView);

    FloatingActionButton addArtistButton = (FloatingActionButton) getActivity().findViewById(
            R.id.fab_add_artist);
    addArtistButton.setOnClickListener(v -> {
        presenter.sendUiEvent(OpenNewArtistEvent.INSTANCE);
    });

    return rootView;
}
 
开发者ID:andreybgm,项目名称:gigreminder,代码行数:26,代码来源:ArtistsFragment.java

示例10: onViewCreated

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRecyclerView = view.findViewById(R.id.recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mAdapter = new DiagnosticAdapter(getContext(), new ArrayList<Diagnostic>());
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(),
            DividerItemDecoration.VERTICAL));
    mAdapter.setListener(new DiagnosticAdapter.OnItemClickListener() {
        @Override
        public void onClick(Diagnostic diagnostic) {
            if (presenter != null) presenter.click(diagnostic);
        }
    });
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:18,代码来源:DiagnosticFragment.java

示例11: initialize

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
@Override
public void initialize(Bundle savedInstanceState) {
    super.initialize(savedInstanceState);
    presenter.runProvider(this);

    RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity().getApplicationContext());
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.addItemDecoration(new DividerItemDecoration(this.getContext(), LinearLayoutManager.VERTICAL));

    refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            presenter.runProvider(CourseAllFragment.this, true);
        }
    });
}
 
开发者ID:mgilangjanuar,项目名称:GoSCELE,代码行数:18,代码来源:CourseAllFragment.java

示例12: onViewCreated

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mRecyclerView = (RecyclerView) view;

    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(),DividerItemDecoration.VERTICAL));
    mRecyclerView.setAdapter(mAdapter = new BaseRecyclerAdapter<Void>(initData(), simple_list_item_2) {
        @Override
        protected void onBindViewHolder(SmartViewHolder holder, Void model, int position) {
            holder.text(android.R.id.text1, String.format(Locale.CHINA, "第%02d条数据", position));
            holder.text(android.R.id.text2, String.format(Locale.CHINA, "这是测试的第%02d条数据", position));
            holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
        }
    });
}
 
开发者ID:scwang90,项目名称:SmartRefreshLayout,代码行数:18,代码来源:ViewPagerUsingFragment.java

示例13: setupRecyclerView

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
public static void setupRecyclerView(EmptySupportedRecyclerView recyclerView,
                                     Context context, View emptyView) {

    // set view to display when there is any content
    recyclerView.setEmptyView(emptyView);

    recyclerView.setHasFixedSize(true);

    // set layout manager as linear
    LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
    recyclerView.setLayoutManager(linearLayoutManager);

    // add divider between items
    DividerItemDecoration dividerItemDecoration =
            new DividerItemDecoration(context, linearLayoutManager.getOrientation());
    recyclerView.addItemDecoration(dividerItemDecoration);
}
 
开发者ID:DSM-DMS,项目名称:DMS,代码行数:18,代码来源:RecyclerViewUtils.java

示例14: init

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
private void init(View view) {
    unbinder = ButterKnife.bind(this, view);

    activity = (AppCompatActivity) getActivity();

    activity.setSupportActionBar(toolbar);
    ActionBar actionBar = activity.getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setTitle(title);
    }

    LinearLayoutManager layoutManager
            = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.addItemDecoration(new DividerItemDecoration(activity, layoutManager.getOrientation()));
    recyclerView.setHasFixedSize(true);
    recyclerView.setMotionEventSplittingEnabled(false);
    recyclerView.setNestedScrollingEnabled(false);
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(genreAdapter);
}
 
开发者ID:prakh25,项目名称:MovieApp,代码行数:24,代码来源:GenreFragment.java

示例15: initLayout

import android.support.v7.widget.DividerItemDecoration; //导入依赖的package包/类
private void initLayout() {
    mProgressBar.setVisibility(View.VISIBLE);
    mSwipeRefreshLayout.setVisibility(View.GONE);
    mSwipeRefreshLayout.setColorSchemeResources(R.color.colorAccent,
            android.R.color.holo_red_light,
            android.R.color.holo_orange_light,
            android.R.color.holo_green_light);
    mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
        @Override
        public void onRefresh() {
            isRefresh = true;
            mPresenter.getMovie(10, 10);
        }
    });
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this,
            DividerItemDecoration.VERTICAL));
}
 
开发者ID:Xianicai,项目名称:TMvpSimple-master,代码行数:19,代码来源:MovieActivity.java


注:本文中的android.support.v7.widget.DividerItemDecoration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。