Java Code Examples for android.support.v7.widget.Toolbar#setTitle()
The following examples show how to use
android.support.v7.widget.Toolbar#setTitle() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From VideoProcessor with Apache License 2.0 | 6 votes |
private void initActionBar() { Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar); setSupportActionBar(toolbar); toolbar.setTitle("VideoProcessor"); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.menu_kichiku: if (selectedVideoUri != null) { executeKichikuVideo(); } else { Toast.makeText(getApplicationContext(), "Please upload a video", Toast.LENGTH_SHORT).show(); } break; } return true; } }); }
Example 2
Source File: Activity_MyComment.java From FoodOrdering with Apache License 2.0 | 6 votes |
private void initView() { mEmptyView=findViewById(R.id.id_empty_view); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(""); TextView toolbarText = (TextView) findViewById(R.id.toolbar_text); toolbarText.setText("我的评价"); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } recyclerView = (EmptyRecyclerView) findViewById(R.id.commentsRecyclerView); swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipeRefreshLayout); swipeRefreshLayout.setOnRefreshListener(this); if (!Util.checkNetwork(Activity_MyComment.this)) { return; } showList(); }
Example 3
Source File: BaseFragment.java From AccountBook with GNU General Public License v3.0 | 6 votes |
/** * 初始化标题栏 */ protected Toolbar initToolbar(String title){ mToolbar = (Toolbar) findViewById(R.id.toolbar); mCompatActivity.setSupportActionBar(mToolbar); ActionBar actionBar = mCompatActivity.getSupportActionBar(); if(actionBar != null){ actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); } // 设置标题 if(!TextUtils.isEmpty(title)){ mToolbar.setTitle(title); } // 设置左侧图标 mToolbar.setNavigationIcon(R.mipmap.ic_back); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBack(); } }); return mToolbar; }
Example 4
Source File: FanListActivity.java From iBeebo with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fan_list_activity_layout); Toolbar mFanToolbar = (Toolbar) findViewById(R.id.fanListToolbar); mFanToolbar.setTitle(getString(R.string.fan_list)); token = getIntent().getStringExtra(Constants.TOKEN); bean = getIntent().getParcelableExtra("user"); if (getSupportFragmentManager().findFragmentByTag(FanListFragment.class.getName()) == null) { getSupportFragmentManager().beginTransaction() .replace(R.id.content, FanListFragment.newInstance(bean), FanListFragment.class.getName()) .commit(); } disPlayHomeAsUp(mFanToolbar); }
Example 5
Source File: CrashReporterActivity.java From CrashReporter with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.crash_reporter_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(getString(R.string.crash_reporter)); toolbar.setSubtitle(getApplicationName()); setSupportActionBar(toolbar); ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager); if (viewPager != null) { setupViewPager(viewPager); } TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); }
Example 6
Source File: PublishActivity.java From monolog-android with MIT License | 6 votes |
private void initUI() { //Set up the toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("写独白"); setSupportActionBar(toolbar); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(true); toolbar.setTitleTextColor(Color.BLACK); //bind view mLinearLayout = (LinearLayout) findViewById(R.id.layout_background); mEtText = (EditText) findViewById(R.id.et_text); mIvImg = (ImageView) findViewById(R.id.iv_img); mTvLocation = (TextView) findViewById(R.id.tv_location); mIvImg.setOnClickListener(this); mTvLocation.setOnClickListener(this); mLinearLayout.setOnClickListener(this); }
Example 7
Source File: Activity_WaitComment.java From FoodOrdering with Apache License 2.0 | 6 votes |
private void initView() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(""); TextView toolbarText = (TextView) findViewById(R.id.toolbar_text); toolbarText.setText("评价订单"); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } ratingBar = (RatingBar) findViewById(R.id.ratingBar_Comment); btnCommit = (Button) findViewById(R.id.btn_commit); etCommentContent = (EditText) findViewById(R.id.etCommentContent); tv_tip = (TextView) findViewById(R.id.tv_tip); btnCommit.setOnClickListener(this); ratingBar.setOnRatingBarChangeListener(this); }
Example 8
Source File: SearchActivity.java From QuranAndroid with GNU General Public License v3.0 | 6 votes |
/** * Function to init views */ private void init() { Intent intent = getIntent(); searchText = intent.getStringExtra(AppConstants.General.SEARCH_TEXT); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(getString(R.string.search)); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); resultsInfo = (TextView) findViewById(R.id.textView13); ayas = new ArrayList<Aya>(); adapter = new SearchShowAdapter(this, searchText, ayas); searchResults = (ListView) findViewById(R.id.listView3); searchResults.setOnItemClickListener(this); searchResults.setEmptyView(findViewById(R.id.progressBar3)); searchResults.setAdapter(adapter); new SearchResults().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
Example 9
Source File: BaseHoldBackActivity.java From FlowGeek with GNU General Public License v2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view; setContentView(view = getLayoutInflater().inflate(onBindLayout(), null)); mToolbar = (Toolbar) view.findViewById(R.id.toolbar); mToolbar.setTitle(""); mToolbar.setSubtitle(onSetTitle()); mToolbar.setNavigationIcon(R.mipmap.icon_back); setSupportActionBar(mToolbar); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); }
Example 10
Source File: LoginActivity.java From CoolChat with Apache License 2.0 | 5 votes |
private void initToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("登录"); setSupportActionBar(toolbar); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); }
Example 11
Source File: SettingsActivity.java From ScreenShift with Apache License 2.0 | 5 votes |
private void setupActionBar() { // get the root container of the preferences list LinearLayout root = (LinearLayout)findViewById(android.R.id.list).getParent().getParent().getParent(); Toolbar bar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.preferences_toolbar, root, false); root.addView(bar, 0); // insert at top bar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); bar.setTitle(R.string.title_activity_general_settings); bar.setTitleTextColor(Color.WHITE); }
Example 12
Source File: Activity_Payment.java From FoodOrdering with Apache License 2.0 | 5 votes |
private void initView() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(""); TextView toolbarText = (TextView) findViewById(R.id.toolbar_text); toolbarText.setText("支付订单"); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } nf = NumberFormat.getCurrencyInstance(); nf.setMaximumFractionDigits(2); recyclerView_payment = (RecyclerView) findViewById(R.id.recycler_payment); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recyclerView_payment.setLayoutManager(layoutManager); Adapter_PaymentWay adapter = new Adapter_PaymentWay(getPayWayData()); recyclerView_payment.setAdapter(adapter); confirm_pay = (Button) findViewById(R.id.confirm_pay); tv_remaining_time = (TextView) findViewById(R.id.tv_remaining_time); tv_cost = (TextView) findViewById(R.id.tv_cost); business_nameAndId = (TextView) findViewById(R.id.business_nameAndId); confirm_pay.setOnClickListener(this); tv_cost.setText(nf.format(cost)); if (businessList != null) { business_nameAndId.setText(businessList.get(0).getName() + "-" + businessList.get(0).getId()); } confirm_pay.setText("确认支付" + nf.format(cost)); }
Example 13
Source File: Update.java From Mizuu with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mIsMovie = getIntent().getExtras().getBoolean("isMovie"); mToolbar = (Toolbar) findViewById(R.id.toolbar); if (!mIsMovie) mToolbar.setTitle(getString(R.string.updateTvShowsTitle)); setSupportActionBar(mToolbar); mTypeface = TypefaceUtils.getRobotoLight(this); mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); mClearLibrary = (CheckBox) findViewById(R.id.checkBox); mClearLibrary.setTypeface(mTypeface); mClearLibrary.setChecked(false); mClearLibrary.setOnCheckedChangeListener(getOnCheckedChangeListener(true)); mRemoveUnavailableFiles = (CheckBox) findViewById(R.id.checkBox2); mRemoveUnavailableFiles.setTypeface(mTypeface); mRemoveUnavailableFiles.setChecked(false); mRemoveUnavailableFiles.setOnCheckedChangeListener(getOnCheckedChangeListener(false)); mFileSourcesDescription = (TextView) findViewById(R.id.file_sources_description); mFileSourcesDescription.setTypeface(mTypeface); mUpdateLibraryDescription = (TextView) findViewById(R.id.update_library_description); mUpdateLibraryDescription.setTypeface(mTypeface); mFileSourcesButton = (Button) findViewById(R.id.select_file_sources_button); mFileSourcesButton.setTypeface(mTypeface); mUpdateLibraryButton = (Button) findViewById(R.id.start_update_button); mUpdateLibraryButton.setTypeface(mTypeface); }
Example 14
Source File: WebViewActivity.java From SwipeBack with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_webview); setDragEdge(SwipeBackLayout.DragEdge.TOP); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(R.string.title_activity_webview); toolbar.setTitleTextColor(Color.WHITE); setSupportActionBar(toolbar); initViews(); }
Example 15
Source File: SettingActivity.java From CoolChat with Apache License 2.0 | 5 votes |
private void initToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle("设置"); setSupportActionBar(toolbar); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { finish(); } }); }
Example 16
Source File: BaseActivity.java From NightWatch with GNU General Public License v3.0 | 5 votes |
private void setupToolbar() { Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(getMenuName()); toolbar.setNavigationIcon(R.drawable.ic_drawer); toolbar.setLogo(R.drawable.ic_icon); setSupportActionBar(toolbar); }
Example 17
Source File: RidesListActivity.java From android-ponewheel with MIT License | 5 votes |
private void setupToolbar() { Toolbar toolbar = findViewById(R.id.tool_bar); toolbar.setTitle("Logged Rides"); toolbar.setLogo(R.mipmap.ic_launcher); setSupportActionBar(toolbar); }
Example 18
Source File: IndividualProductSeller.java From NITKart with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_individual_product_seller); progressBar = (ProgressBar) findViewById(R.id.individualProductPageProgressBarSeller); progressBar.setVisibility(View.VISIBLE); item = (ShoppingItem) getIntent().getSerializableExtra("product"); quantity = item.getQuantity(); removeProduct = (Button) findViewById(R.id.deleteProductSeller); myRef = database.getReference("sellers/" + FirebaseAuth.getInstance().getCurrentUser().getUid()); removeProduct.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { myRef.addListenerForSingleValueEvent(new ValueEventListener() { ArrayList<ShoppingItem> productList = new ArrayList<>(); @Override public void onDataChange(DataSnapshot dataSnapshot) { // for getting the list of products. shuold probably make this a new class tbh. for (DataSnapshot snap : dataSnapshot.child("products").getChildren()) { int itemPrice = -1; try { itemPrice = Integer.valueOf(NumberFormat.getCurrencyInstance() .parse(String.valueOf(snap.child("price").getValue())) .toString()); } catch (ParseException e) { e.printStackTrace(); } String productID = snap.child("productID").getValue().toString(); productList.add(new ShoppingItem( productID, snap.child("title").getValue().toString(), snap.child("type").getValue().toString(), snap.child("description").getValue().toString(), itemPrice, Integer.valueOf(snap.child("quantity").getValue().toString()) )); } for (ShoppingItem x : productList){ if(x.getProductID().equals(item.getProductID())){ productList.remove(x); break; } } if(productList.size() == 0){ myRef.child("isProdsEmpty").setValue(Boolean.TRUE.toString()); productList.add(new ShoppingItem("", "", "", "", -1, -1)); } Map<String, Object> seller_products = new HashMap<>(); seller_products.put("products", productList); myRef.updateChildren(seller_products); Toast.makeText(getApplicationContext(), "Removed!", Toast.LENGTH_SHORT).show(); finish(); } @Override public void onCancelled(DatabaseError databaseError) { } }); } }); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarSeller); toolbar.setTitle(""); // setSupportActionBar(toolbar); ip = getResources().getString(R.string.ip); name = (TextView) findViewById(R.id.productNameIndividualProductSeller); name.setText(item.getTitle()); description = (TextView) findViewById(R.id.productDescriptionIndividualProductSeller); description.setText(item.getDescription()); quantityView = (TextView) findViewById(R.id.quantityIndividualProductSeller); quantityView.setText(String.valueOf(quantity)); ((TextView) findViewById(R.id.productPriceIndividualProductSeller)) .setText(item.getPrice()); productImage = (ImageView) findViewById(R.id.productImageIndividualProductSeller); Picasso.with(getApplicationContext()) .load(ip + String.valueOf(item.getProductID()) + ".jpg") .fit() .into(productImage); progressBar.setVisibility(View.GONE); }
Example 19
Source File: UIView.java From o2oa with GNU Affero General Public License v3.0 | 4 votes |
public void setToolBar(int toolbarId, int titleId, int logoId) { toolbar = (Toolbar) findViewById(toolbarId); toolbar.setTitle(titleId); toolbar.setLogo(logoId); setSupportActionBar(toolbar); }
Example 20
Source File: ToolbarAdapter.java From MVVM-JueJin with MIT License | 4 votes |
@BindingAdapter(value = {"title"}, requireAll = false) public static void bind(Toolbar toolbar, String title){ toolbar.setTitle(title); }