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


Java DrawerAdapter类代码示例

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


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

示例1: getDrawerAdapter

import com.mikepenz.materialdrawer.adapter.DrawerAdapter; //导入依赖的package包/类
public DrawerAdapter getDrawerAdapter() {
    return mDrawerAdapter;
}
 
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:4,代码来源:MiniDrawer.java

示例2: build

import com.mikepenz.materialdrawer.adapter.DrawerAdapter; //导入依赖的package包/类
/**
 * build the MiniDrawer
 *
 * @param ctx
 * @return
 */
public View build(Context ctx) {
    mContainer = new LinearLayout(ctx);
    if (mInnerShadow) {
        if (!mInRTL) {
            mContainer.setBackgroundResource(R.drawable.material_drawer_shadow_left);
        } else {
            mContainer.setBackgroundResource(R.drawable.material_drawer_shadow_right);
        }
    }

    //create and append recyclerView
    mRecyclerView = new RecyclerView(ctx);
    mContainer.addView(mRecyclerView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    //set the itemAnimator
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    //some style improvements on older devices
    mRecyclerView.setFadingEdgeLength(0);
    //set the drawing cache background to the same color as the slider to improve performance
    //mRecyclerView.setDrawingCacheBackgroundColor(UIUtils.getThemeColorFromAttrOrRes(mActivity, R.attr.material_drawer_background, R.color.material_drawer_background));
    mRecyclerView.setClipToPadding(false);
    //additional stuff
    mRecyclerView.setLayoutManager(new LinearLayoutManager(ctx));
    //adapter
    mDrawerAdapter = new DrawerAdapter();
    mRecyclerView.setAdapter(mDrawerAdapter);

    //if the activity with the drawer should be fullscreen add the padding for the statusbar
    if (mDrawer != null && mDrawer.mDrawerBuilder != null && (mDrawer.mDrawerBuilder.mFullscreen || mDrawer.mDrawerBuilder.mTranslucentStatusBar)) {
        mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(), UIUtils.getStatusBarHeight(ctx), mRecyclerView.getPaddingRight(), mRecyclerView.getPaddingBottom());
    }

    //if the activity with the drawer should be fullscreen add the padding for the navigationBar
    if (mDrawer != null && mDrawer.mDrawerBuilder != null && (mDrawer.mDrawerBuilder.mFullscreen || mDrawer.mDrawerBuilder.mTranslucentNavigationBar)) {
        mRecyclerView.setPadding(mRecyclerView.getPaddingLeft(), mRecyclerView.getPaddingTop(), mRecyclerView.getPaddingRight(), UIUtils.getNavigationBarHeight(ctx));
    }

    //set the adapter with the items
    createItems();

    return mContainer;
}
 
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:49,代码来源:MiniDrawer.java


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