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


Java NavigationView.findViewById方法代码示例

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


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

示例1: initView

import android.support.design.widget.NavigationView; //导入方法依赖的package包/类
@Override
protected void initView() {
    ShortCutUtil.addShortcut(getApplicationContext());

    new RevealEffectUtil().createEnterRevealEffect(this);

    mToolbar.setLogo(R.drawable.vector_user_default_logo);
    mToolbar.setTitleMarginStart(30);
    setToolbarTitle(getString(R.string.nav_home_page));

    mDrawerLayout = findView(R.id.drawer_layout);

    mToggle = new ActionBarDrawerToggle(this, mDrawerLayout, mToolbar, 0, 0);

    NavigationView navigationView = findView(R.id.navigation_view);
    navigationView.setNavigationItemSelectedListener(this);
    ImageView userLogo = (ImageView) navigationView.findViewById(R.id.nav_user_logo);


    mToggle.syncState();
    mDrawerLayout.addDrawerListener(mToggle);

    PackageManager pm = getPackageManager();

    FeatureInfo[] features = pm.getSystemAvailableFeatures(); //得到所有支援的硬件种类
    Log.d(TAG, "initView: feature:size:" + (features == null));
    for (FeatureInfo feature : features) {
        if (feature != null) {
            String name = feature.name;
            if (TextUtils.isEmpty(name)) {
                Log.v(TAG, "name2: " + feature.reqGlEsVersion);
            } else {
                Log.v(TAG, "name1: " + feature.name);
            }
        } else {
            Log.d(TAG, "空!");
        }
    }

}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:41,代码来源:MainActivity.java

示例2: onCreate

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

    kek = (CrumbView) findViewById(R.id.view_kek);
    kek.post(new Runnable() {
        @Override
        public void run() {
            generatePath();
        }
    });

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            generatePath();
        }
    });

    drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    dotIntervalText = (EditText) navigationView.findViewById(R.id.text_dot_interval);
    dotIntervalText.setText(String.valueOf(kek.getDotInterval()));
    dotRadiusText = (EditText) navigationView.findViewById(R.id.text_dot_radius);
    dotRadiusText.setText(String.valueOf(kek.getDotRadius()));

    drawer.addDrawerListener(new DrawerLayout.SimpleDrawerListener() {
        @Override
        public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            kek.setDotInterval(Integer.valueOf(dotIntervalText.getText().toString()));
            kek.setDotRadius(Integer.valueOf(dotRadiusText.getText().toString()));
            kek.invalidate();
        }
    });
}
 
开发者ID:Deliganli,项目名称:crumber,代码行数:46,代码来源:MainActivity.java


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