本文整理汇总了Java中android.support.v7.widget.Toolbar.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.setTitle方法的具体用法?Java Toolbar.setTitle怎么用?Java Toolbar.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.Toolbar
的用法示例。
在下文中一共展示了Toolbar.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyFontToToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
/**
* Will forceably set text on the views then remove ones that didn't have copy.
*
* @param view toolbar view.
*/
private void applyFontToToolbar(final Toolbar view) {
final CharSequence previousTitle = view.getTitle();
final CharSequence previousSubtitle = view.getSubtitle();
// The toolbar inflates both the title and the subtitle views lazily but luckily they do it
// synchronously when you set a title and a subtitle programmatically.
// So we set a title and a subtitle to something, then get the views, then revert.
view.setTitle(" ");
view.setSubtitle(" ");
// Iterate through the children to run post inflation on them
final int childCount = view.getChildCount();
for (int i = 0; i < childCount; i++) {
onViewCreated(view.getChildAt(i), view.getContext(), null);
}
// Remove views from view if they didn't have copy set.
view.setTitle(previousTitle);
view.setSubtitle(previousSubtitle);
}
示例2: initToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void initToolbar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.pickerToolbar);
toolbar.setTitleTextColor(getResources().getColor(R.color.white));
toolbar.setTitle(R.string.image);
toolbar.setNavigationIcon(R.drawable.icon_header_left);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
// getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// getSupportActionBar().setDisplayShowHomeEnabled(true);
// getSupportActionBar().setHomeButtonEnabled(true);
// getSupportActionBar().setHomeAsUpIndicator(getResources().getDrawable(R.drawable.icon_header_left));
setSupportActionBar(toolbar);
}
示例3: initToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
protected void initToolbar(Toolbar toolbar) {
if (toolbar == null) {
return;
}
toolbar.setTitle(R.string.app_name);//必要
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.mipmap.ic_action_mode_back);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
示例4: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.redes_sociais);
textView = (TextView)findViewById(R.id.fragment_title);
//INICIO DA GAMBIARRA
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("");
textView.setText("Redes Sociais");
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//FIM DA GAMBIARRA
twitterHashtag = new TwitterHashtag();
facebook = new Facebook();
instagram = new Instagram();
fm = getSupportFragmentManager();
ft = fm.beginTransaction();
if(ft.isEmpty()){
ft.add(R.id.content, twitterHashtag);
ft.commit();
}
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
示例5: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mRlBottomSheet = (RelativeLayout) findViewById(R.id.rl_bottom_sheet);
mFrom = BottomSheetBehavior.from(mRlBottomSheet);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
// 该属性必须在setSupportActionBar之前 调用
mToolbar.setTitle("toolBar");
setSupportActionBar(mToolbar);
initListener();
initData();
}
示例6: setToolbarAsBack
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
public static void setToolbarAsBack(final AppCompatActivity activity, int id, String title) {
Toolbar toolbar = (Toolbar) activity.findViewById(id);
toolbar.setTitle(title);
activity.setSupportActionBar(toolbar);
if (activity.getSupportActionBar() != null) {
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
activity.finish();
}
});
activity.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
示例7: setUpToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void setUpToolbar() {
Toolbar toolbar = $(R.id.toolbar);
toolbar.setTitle(R.string.text_setting);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
示例8: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_coordinator_layout);
Toolbar mToolbar = findViewById(R.id.toolbar);
mToolbar.setTitle("CoordinatorLayout");
setSupportActionBar(mToolbar);
}
示例9: onCreateView
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_profile, container, false);
if (!isUserSet()) return view;
if (!isCurrentUser()) {
DrawerActivity activity = (DrawerActivity) getActivity();
Toolbar toolbar = (Toolbar) activity.findViewById(R.id.toolbar);
if (toolbar != null) toolbar.setTitle(mUser.getFullName());
activity.updateMenu();
}
FragmentTabHost tabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);
tabHost.setup(getContext(), getChildFragmentManager(), android.R.id.tabcontent);
ProfileInfoFragment profileInfoFragment = ProfileInfoFragment.newInstance(mUser);
IssuesProfileFragment issuesFragment = IssuesProfileFragment.newInstance(mUser);
BadgeViewFragment badgeViewFragment = BadgeViewFragment.newInstance(mUser);
tabHost.addTab(tabHost.newTabSpec(getString(R.string.tab_spec_issues))
.setIndicator(getString(R.string.tab_label_issues), null),
issuesFragment.getClass(), issuesFragment.getArguments());
tabHost.addTab(tabHost.newTabSpec(getString(R.string.tab_spec_badges))
.setIndicator(getString(R.string.tab_label_badges), null),
badgeViewFragment.getClass(), badgeViewFragment.getArguments());
getChildFragmentManager().beginTransaction()
.replace(R.id.profile_info_fragment_placeholder, profileInfoFragment).commit();
return view;
}
示例10: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_confirm_finished);
Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
toolbar.setTitle("接单详情");
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if(actionBar != null){
actionBar.setDisplayHomeAsUpEnabled(true);
}
initView();
}
示例11: initToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void initToolbar() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setTitle("Title");
toolbar.setSubtitle("Subtitle");
toolbar.setNavigationIcon(R.drawable.actionbar_discover_normal);
}
示例12: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setTitle("");
setSupportActionBar(toolbar);
HandleProfileViewBehavior handleProfileViewBehavior =
new HandleProfileViewBehavior(findViewById(R.id.activity_main));
}
示例13: initView
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void initView() {
mTbImagePick = (Toolbar) findViewById(com.vincent.filepicker.R.id.tb_file_pick);
mTbImagePick.setTitle("請選擇檔案");
setSupportActionBar(mTbImagePick);
mTbImagePick.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mRecyclerView = (RecyclerView) findViewById(com.vincent.filepicker.R.id.rv_file_pick);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.addItemDecoration(new DividerListItemDecoration(this,
LinearLayoutManager.VERTICAL, com.vincent.filepicker.R.drawable.divider_rv_file));
mAdapter = new CustomFilePickAdapter(this, mMaxNumber);
mRecyclerView.setAdapter(mAdapter);
mAdapter.setOnSelectStateListener(new OnSelectStateListener<NormalFile>() {
@Override
public void OnSelectStateChanged(boolean state, NormalFile file) {
if (state)
mSelectedList.add(file);
else
mSelectedList.remove(file);
}
});
mProgressBar = (ProgressBar) findViewById(com.vincent.filepicker.R.id.pb_file_pick);
}
示例14: initToolbar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void initToolbar(Toolbar toolbar) {
super.initToolbar(toolbar);
toolbar.setTitle("注册");
}
示例15: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_contributors);
String BASE_URL = "https://github.com/";
rvContributors = (RecyclerView) findViewById(R.id.contributors_view);
contributorsItems = new ArrayList<>();
contributorsItems.add(new contributorsItem("Tanuja Medisetti", BASE_URL + "TanujaMedisetti87.png" , BASE_URL + "TanujaMedisetti87"));
contributorsItems.add(new contributorsItem("Nishant Chaudhary", BASE_URL + "nishant23j.png", BASE_URL + "nishant23j"));
contributorsItems.add(new contributorsItem("Shubham Naik", BASE_URL + "nrshubham.png", BASE_URL + "nrshubham"));
contributorsItems.add(new contributorsItem("Ashima Anand", BASE_URL + "ashima1795.png", BASE_URL + "ashima1795"));
//contributorsItems.add(new contributorsItem("", BASE_URL + ".png", BASE_URL + ""));
contributorsItems.add(new contributorsItem("Ashish Gurjar", BASE_URL + "akgurjar.png", BASE_URL + "akgurjar"));
contributorsItems.add(new contributorsItem("Sahil Ramola", BASE_URL + "RamolaWeb.png", BASE_URL + "RamolaWeb"));
contributorsItems.add(new contributorsItem("Sukhbir Singh", BASE_URL + "sukhbir-singh.png",BASE_URL + "sukhbir-singh"));
contributorsItems.add(new contributorsItem("Jalaz Kumar", BASE_URL + "jaykay12.png", BASE_URL + "jaykay12"));
contributorsItems.add(new contributorsItem("Narendra Dodwaria", BASE_URL + "narendra36.png", BASE_URL + "narendra36"));
contributorsItems.add(new contributorsItem("Goutham Reddy ", BASE_URL + "zeus512.png", BASE_URL + "zeus512"));
contributorsItems.add(new contributorsItem("Vijaya Laxmi", BASE_URL + "vijaya22.png", BASE_URL + "vijaya22"));
contributorsItems.add(new contributorsItem("Suraj Negi", BASE_URL + "Akatsuki06.png",BASE_URL + "Akatsuki06"));
contributorsItems.add(new contributorsItem("Aditya Arora", BASE_URL + "adi23arora.png",BASE_URL + "adi23arora"));
contributorsItems.add(new contributorsItem("Parvesh Dhull", BASE_URL + "Parveshdhull.png", BASE_URL + "Parveshdhull"));
contributorsItems.add(new contributorsItem("Nitin", BASE_URL + "iamNitin16.png", BASE_URL + "iamNitin16"));
contributorsItems.add(new contributorsItem("Jatin", BASE_URL + "Jatin0312.png", BASE_URL + "Jatin0312"));
contributorsItems.add(new contributorsItem("Vibhor Garg", BASE_URL + "vibhorg.png", BASE_URL + "vibhorg"));
contributorsItems.add(new contributorsItem("Kumar Shashwat", BASE_URL + "octacode.png",BASE_URL + "octacode"));
contributorsItems.add(new contributorsItem("Hemant Singh ", BASE_URL + "joshafest.png", BASE_URL + "joshafest"));
contributorsItems.add(new contributorsItem("Aditya Wazir", BASE_URL + "adityawazir.png",BASE_URL + "adityawazir"));
contributorsItems.add(new contributorsItem("Bharat Shah", BASE_URL + "bharatshah1498.png",BASE_URL + "bharatshah1498"));
contributorsItems.add(new contributorsItem("Aman Pratap Singh", BASE_URL + "mnprtpsingh.png",BASE_URL + "mnprtpsingh"));
contributorsItems.add(new contributorsItem("Palak Sood", BASE_URL + "palak97.png",BASE_URL + "palak97"));
contributorsItems.add(new contributorsItem("Kartik Saxena", BASE_URL + "SaxenaKartik.png",BASE_URL + "SaxenaKartik"));
contributorsItems.add(new contributorsItem("Muskan Jhunjhunwalla", BASE_URL + "musukeshu.png",BASE_URL + "musukeshu"));
contributorsItems.add(new contributorsItem("Anubhaw Bhalotia", BASE_URL + "anubhawbhalotia.png",BASE_URL + "anubhawbhalotia"));
ContributorAdapter = new contributorsAdapter(contributorsItems, ContributorsActivity.this);
rvContributors.setAdapter(ContributorAdapter);
tbContributers = (Toolbar) findViewById(R.id.contributors_toolbar);
tbContributers.setTitle("Contributors");
setSupportActionBar(tbContributers);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
LinearLayoutManager lvmanager = new LinearLayoutManager(this);
lvmanager.setOrientation(LinearLayoutManager.VERTICAL);
rvContributors.setLayoutManager(lvmanager);
}