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


Java DrawerLayout.setScrimColor方法代码示例

本文整理汇总了Java中android.support.v4.widget.DrawerLayout.setScrimColor方法的典型用法代码示例。如果您正苦于以下问题:Java DrawerLayout.setScrimColor方法的具体用法?Java DrawerLayout.setScrimColor怎么用?Java DrawerLayout.setScrimColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.widget.DrawerLayout的用法示例。


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

示例1: onCreate

import android.support.v4.widget.DrawerLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    contentFragment = MainContentFragment.newInstance(R.drawable.home_bg1);
    fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction()
            .replace(R.id.content_frame, contentFragment)
            .commit();
    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawerLayout.setScrimColor(Color.TRANSPARENT);
    linearLayout = (LinearLayout) findViewById(R.id.left_drawer);
    linearLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            drawerLayout.closeDrawers();
        }
    });

    setActionBar();
    initMenuFragment();
    createMenuList();
    viewAnimator = new ViewAnimator<>(this, list, contentFragment, drawerLayout, this);
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:26,代码来源:MainActivity.java

示例2: onCreate

import android.support.v4.widget.DrawerLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);

    // listen for navigation events
    mNavigationView = (NavigationView) findViewById(R.id.nav_view);

    if (mNavigationView != null) {
        mNavigationView.setNavigationItemSelectedListener(this);

        // select the correct nav menu item
        MenuItem menuItem = mNavigationView.getMenu().findItem(getMenuItem());
        if (menuItem != null)
            menuItem.setChecked(true);
        if (DataUtils.hideDrawer(this)) {
            // set up the hamburger icon to open and close the drawer_logged_in
            mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, R.string.open, R.string.close) {
                @Override
                public void onDrawerSlide(View drawerView, float slideOffset) {
                    super.onDrawerSlide(drawerView, 0);
                }
            };
            mDrawerLayout.setDrawerListener(mDrawerToggle);
            mDrawerToggle.syncState();
        } else {
            mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
            mDrawerLayout.setScrimColor(0x00000000);
            mDrawerLayout.requestDisallowInterceptTouchEvent(true);
            if (mToolbar != null) {
                RelativeLayout.LayoutParams mToolbarLayoutParams = ((RelativeLayout.LayoutParams) mToolbar.getLayoutParams());
                mToolbarLayoutParams.setMargins(mToolbarLayoutParams.leftMargin + getResources().getDimensionPixelSize(R.dimen.drawer_size), mToolbarLayoutParams.topMargin, mToolbarLayoutParams.rightMargin, mToolbarLayoutParams.bottomMargin);
            }
            if (mMainContent != null) {
                RelativeLayout.LayoutParams mMainContentLayoutParams = ((RelativeLayout.LayoutParams) mMainContent.getLayoutParams());
                mMainContentLayoutParams.setMargins(mMainContentLayoutParams.leftMargin + getResources().getDimensionPixelSize(R.dimen.drawer_size), mMainContentLayoutParams.topMargin, mMainContentLayoutParams.rightMargin, mMainContentLayoutParams.bottomMargin);
            }
        }
    }
}
 
开发者ID:gregoreesmaa,项目名称:minu-poska-android,代码行数:41,代码来源:DrawerBaseActivity.java

示例3: onCreate

import android.support.v4.widget.DrawerLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (loggedIn) {
                Intent myIntent = new Intent(MainActivity.this, PostCallActivity.class);
                MainActivity.this.startActivity(myIntent);
            } else {
                Snackbar.make(findViewById(R.id.container), getString(R.string.error_logged_in), Snackbar.LENGTH_LONG).setAction("Action", null).show();
            }

        }
    });

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);


    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    if (savedInstanceState == null) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction ft = fragmentManager.beginTransaction();
        ft.replace(R.id.container, WelcomeFragment.newInstance(loggedIn));
        ft.commit();
    }
    FrameLayout frameLayout = (FrameLayout) findViewById(R.id.content_frame);
    if (((ViewGroup.MarginLayoutParams)frameLayout.getLayoutParams()).leftMargin == (int) getResources().getDimension(R.dimen.drawer_size)) {
        drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_OPEN);
        drawer.setScrimColor(Color.TRANSPARENT);
        isDrawerLocked = true;
        Log.d(TAG, "Drawer locked");
    }
    if (!isDrawerLocked) {

        ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
        drawer.addDrawerListener(toggle);
        toggle.syncState();
    }



}
 
开发者ID:DecentralizedAmateurPagingNetwork,项目名称:DAPNETApp,代码行数:52,代码来源:MainActivity.java


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