本文整理汇总了Java中android.support.v7.widget.Toolbar.findViewById方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.findViewById方法的具体用法?Java Toolbar.findViewById怎么用?Java Toolbar.findViewById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.Toolbar
的用法示例。
在下文中一共展示了Toolbar.findViewById方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
protected void setupToolbar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
TextView toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
Typeface myTypeface = Typeface.createFromAsset(getAssets(), "fonts/JosefinSans.ttf");
toolbarTitle.setTypeface(myTypeface);
toolbar.setNavigationIcon(R.drawable.ic_menu_white);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDrawer.toggleMenu();
}
});
}
示例2: ToolbarHelper
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public ToolbarHelper(Toolbar toolbar) throws IllegalAccessException {
this.toolbar = toolbar;
context = toolbar.getContext();
leftBtn = (ImageView) toolbar.findViewById(R.id.left_button);
rightBtn = (TextView) toolbar.findViewById(R.id.right_button);
if (rightBtn == null) {
throw new IllegalAccessException("Can't find this right button");
}
if (leftBtn == null) {
throw new IllegalAccessException("Can't find this Left button");
}
tvTitle = (TextView) toolbar.findViewById(R.id.tvTitleToolbar);
if (tvTitle == null) {
throw new IllegalAccessException("Can't find this Title TextView");
}
}
示例3: ToolbarHelper
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public ToolbarHelper(Toolbar toolbar) throws IllegalAccessException {
this.toolbar = toolbar;
context = toolbar.getContext();
leftBtn = (AppCompatTextView) toolbar.findViewById(R.id.left_button);
rightBtn = (AppCompatTextView) toolbar.findViewById(R.id.right_button);
if (rightBtn == null) {
throw new IllegalAccessException("Can't find this right button.");
} else {
rightBtn.setClickable(true);
}
if (leftBtn == null) {
throw new IllegalAccessException("Can't find this Left button");
} else {
leftBtn.setClickable(true);
}
tvTitle = (AppCompatTextView) toolbar.findViewById(R.id.tvTitleToolbar);
if (tvTitle == null) {
throw new IllegalAccessException("Can't find this Title TextView");
} else {
tvTitle.setClickable(true);
}
}
示例4: setupToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setupToolbar(String title, String subTitle, boolean homeButtonEnabled) {
toolbar = (Toolbar) findViewById(R.id.toolbar_layout);
textView = (TextView) toolbar.findViewById(R.id.toolbar_title);
toolbar.setTitle("");
toolbarIcon = (RoundedImageView) toolbar.findViewById(R.id.toolbar_icon);
if (!HTTextUtils.isEmpty(title)) {
textView.setText(title);
}
if (!HTTextUtils.isEmpty(subTitle)) {
textView.setText(subTitle);
}
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(homeButtonEnabled);
getSupportActionBar().setHomeButtonEnabled(homeButtonEnabled);
}
示例5: fixTitlebarColor
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void fixTitlebarColor(Toolbar toolbar, Context context) {
int textColor = 0;
if(SDK_INT <= 23) {
textColor = Color.parseColor("#ffffffff");
} else {
textColor = context.getColor(R.color.editTitlebarTextColor);
}
toolbar.setTitleTextColor(textColor);
TextView saveItem = (TextView) toolbar.findViewById(R.id.save_menu);
saveItem.setTextColor(textColor);
}
示例6: setupAppBar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setupAppBar() {
setStatusBarColor(this.mStatusBarColor);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setBackgroundColor(this.mToolbarColor);
toolbar.setTitleTextColor(this.mToolbarTextColor);
TextView toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
toolbarTitle.setTextColor(this.mToolbarTextColor);
toolbarTitle.setText(this.mToolbarTitle);
Drawable stateButtonDrawable = ContextCompat.getDrawable(this, R.drawable.ucrop_ic_cross)
.mutate();
stateButtonDrawable.setColorFilter(this.mToolbarTextColor, Mode.SRC_ATOP);
toolbar.setNavigationIcon(stateButtonDrawable);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
}
}
示例7: bindView
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void bindView(){
btnClose = (Button) findViewById( R.id.btn_close );
rvOrder = (RecyclerView) findViewById( R.id.rv_order );
tvTotalPrice = (TextView) findViewById( R.id.tv_total_price );
tvDate = (TextView) findViewById( R.id.tv_date );
toolbar = (Toolbar) findViewById( R.id.toolbar );
btnBack = (ImageView) toolbar.findViewById( R.id.toolbar_back );
}
示例8: setUpToolBar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setUpToolBar() {
Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
TextView titleTextView = toolbar.findViewById(R.id.toolbar_title);
titleTextView.setText("Permission Groups");
toolbar.setTitle("");
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(false);
}
示例9: setUpToolBar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setUpToolBar() {
Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
toolbar.setTitle("");
titleTextView = toolbar.findViewById(R.id.toolbar_title);
((AppCompatActivity) getActivity()).setSupportActionBar(toolbar);
ActionBar supportActionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
supportActionBar.setDisplayHomeAsUpEnabled(true);
supportActionBar.setHomeAsUpIndicator(R.drawable.ic_arrow_back_white);
}
示例10: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
titleTV=(TextView)mToolbar.findViewById(R.id.toolbar_center_title);
titleTV.setText("FlyToCartAnimation");
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
List<Product> list = makeProductsList();
ProductAdapter adapter = new ProductAdapter(this, list);
mRecyclerView.setAdapter(adapter);
adapter.setActionListener(new ProductAdapter.ProductItemActionListener() {
@Override
public void onItemTap(ImageView imageView) {
if (imageView != null)
makeFlyAnimation(imageView);
}
});
}
示例11: setupToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void setupToolbar(int toolbarId, String titleToolbar){
toolbar = (Toolbar) findViewById(toolbarId);
toolbar.setContentInsetsAbsolute(0,0);
TextView title = (TextView) toolbar.findViewById(R.id.tv_title);
title.setText(titleToolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
}
示例12: setupToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public final void setupToolbar(int toolbarId, String titlePage){
toolbar = (Toolbar) findViewById(toolbarId);
setSupportActionBar(toolbar);
title = (TextView) toolbar.findViewById(R.id.tv_title);
title.setText(titlePage);
getSupportActionBar().setTitle("");
}
示例13: setupToolbarWithUpNav
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void setupToolbarWithUpNav(int toolbarId, String titlePage, @DrawableRes int res){
toolbar = (Toolbar) findViewById(toolbarId);
setSupportActionBar(toolbar);
title = (TextView) toolbar.findViewById(R.id.tv_title);
title.setText(titlePage);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(res);
getSupportActionBar().setTitle("");
}
示例14: getViews
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void getViews() {
mShadeLayer = findViewById(R.id.shade_layer);
mContentLayout = (RelativeLayout) findViewById(R.id.include);
mToolBar = (Toolbar) findViewById(R.id.toolbar);
mShareBtn = (ImageView) mToolBar.findViewById(R.id.iv_share);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mTabLayout = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mViewPager = (ViewPager) findViewById(R.id.pager);
mMenuBtn = (ImageView) findViewById(R.id.iv_menu);
mCollectionLayout = (RelativeLayout) findViewById(R.id.rl_my_collection);
mFeedbackLayout = (RelativeLayout) findViewById(R.id.rl_feedback);
mClearCacheLayout = (RelativeLayout) findViewById(R.id.rl_clear_cache);
rl_map = (RelativeLayout) findViewById(R.id.rl_map);
rl_favourable = (RelativeLayout) findViewById(R.id.rl_favourable);
size = (TextView)findViewById(R.id.size);
version_code = (TextView)findViewById(R.id.version_code);
mHelpLayout = (RelativeLayout) findViewById(R.id.rl_help);
mCheckUpLayout = (RelativeLayout) findViewById(R.id.rl_checkup);
recommend_la = (RelativeLayout) findViewById(R.id.recommend_la);
logo_la = (RelativeLayout) findViewById(R.id.logo_la);
la = (RelativeLayout) findViewById(R.id.la);
mParentLayout = (CoordinatorLayout) findViewById(R.id.parent_layout);
mCategoryNameLabel = (TextView) findViewById(R.id.tv_category_name);
mShadeLayout = (RelativeLayout) findViewById(R.id.shade);
mShadeViewPager = (ViewPager) findViewById(R.id.pager_shade);
mShadeTabContainer = (PagerSlidingTabStrip) findViewById(R.id.tabs_shade);
}
示例15: setupToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public void setupToolbar(int toolbarId, String title, @ColorRes int titleColor, @ColorRes int colorBg, @DrawableRes int burger){
toolbar = (Toolbar) findViewById(toolbarId);
toolbar.setBackgroundColor(getResources().getColor(colorBg));
setSupportActionBar(toolbar);
TextView pageTitle = (TextView) toolbar.findViewById(R.id.tv_title);
pageTitle.setText(title);
pageTitle.setTextColor(getResources().getColor(titleColor));
getSupportActionBar().setTitle("");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeAsUpIndicator(burger);
}