本文整理匯總了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, "空!");
}
}
}
示例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();
}
});
}