androidx.appcompat.widget.Toolbar.findViewById()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中androidx.appcompat.widget.Toolbar.findViewById()方法的一些代码示例,展示了Toolbar.findViewById()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Toolbar.findViewById()方法的具体详情如下:
包路径:androidx.appcompat.widget.Toolbar
类名称:Toolbar
方法名:findViewById

Toolbar.findViewById介绍

暂无

代码示例

代码示例来源:origin: KeepSafe/TapTargetView

ToolbarTapTarget(Toolbar toolbar, @IdRes int menuItemId,
         CharSequence title, @Nullable CharSequence description) {
 super(toolbar.findViewById(menuItemId), title, description);
}

代码示例来源:origin: skydoves/ColorPickerPreference

public void setToolbarTitle(String title) {
 Toolbar toolbar = findViewById(R.id.toolbar);
 TextView textView = toolbar.findViewById(R.id.toolbar_title);
 textView.setText(title);
 ImageView back = toolbar.findViewById(R.id.toolbar_home);
 back.setOnClickListener(
   new View.OnClickListener() {
    @Override
    public void onClick(View view) {
     finish();
    }
   });
}

代码示例来源:origin: darkskygit/VirtualApp

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_clone_app);
  Toolbar mToolBar = findViewById(R.id.clone_app_tool_bar);
  TabLayout mTabLayout = mToolBar.findViewById(R.id.clone_app_tab_layout);
  mViewPager = findViewById(R.id.clone_app_view_pager);
  mViewPager.setAdapter(new AppPagerAdapter(getSupportFragmentManager()));
  mTabLayout.setupWithViewPager(mViewPager);
  // Request permission to access external storage
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
      ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
    }
  }
}

相关文章