本文整理汇总了Java中android.support.v7.widget.Toolbar.setSubtitle方法的典型用法代码示例。如果您正苦于以下问题:Java Toolbar.setSubtitle方法的具体用法?Java Toolbar.setSubtitle怎么用?Java Toolbar.setSubtitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v7.widget.Toolbar
的用法示例。
在下文中一共展示了Toolbar.setSubtitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
// App Logo
toolbar.setLogo(R.drawable.ic_launcher);
// Title
toolbar.setTitle("My Title");
// Sub Title
toolbar.setSubtitle("Sub title");
setSupportActionBar(toolbar);
// Navigation Icon 要設定在 setSupoortActionBar 才有作用
// 否則會出現 back bottom
toolbar.setNavigationIcon(R.drawable.ab_android);
// Menu item click 的監聽事件一樣要設定在 setSupportActionBar 才有作用
toolbar.setOnMenuItemClickListener(onMenuItemClick);
}
示例2: setToolBar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
protected void setToolBar(Toolbar toolbar, CharSequence title, boolean backIcon, CharSequence
subTitle, @DrawableRes int logo) {
if (logo !=0){
toolbar.setLogo(logo);
}
if (!TextUtils.isEmpty(subTitle)){
toolbar.setSubtitle(subTitle);
}
if (!TextUtils.isEmpty(title)){
toolbar.setTitle(title);
}
setSupportActionBar(toolbar);
if (backIcon) {
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
}
示例3: 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);
}
示例4: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@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);
}
示例5: 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);
setSupportActionBar(toolbar);
toolbar.setSubtitle("By soussidev");
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(view -> {
//Set Default Text to Button
btn_loading_observe.setText("Show Loading Observe");
btn_loadig_flowable.setText("Show Loading Flowable");
});
InitView();
//Init Observe for btn observe
user_Observable = Observable
.timer(TIME_DELAY, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
.doOnTerminate(() -> btn_loading_observe.setText("Observing Again"))
.doOnComplete(() -> AnimationView()) //if complete show animation
.map(aLong -> getMessageResult()); //Call function messageresult()
//Init Flowable for btn Floable
user_Flowable = Flowable
.timer(TIME_DELAY, TimeUnit.MILLISECONDS, AndroidSchedulers.mainThread())
.doOnComplete(() -> btn_loadig_flowable.setText("Flowable Again"))
.doOnComplete(() -> AnimationView()) //if complete show animation
.map(aLong -> getMessageResult()); //Call function messageresult()
}
示例6: ToolbarLayoutListener
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private ToolbarLayoutListener(final CalligraphyFactory calligraphyFactory,
final Context context, Toolbar toolbar) {
mCalligraphyFactory = new WeakReference<>(calligraphyFactory);
mContextRef = new WeakReference<>(context);
mToolbarReference = new WeakReference<>(toolbar);
originalSubTitle = toolbar.getSubtitle();
toolbar.setSubtitle(BLANK);
}
示例7: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chuck_activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
toolbar.setSubtitle(getApplicationName());
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, TransactionListFragment.newInstance())
.commit();
}
}
示例8: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post_search);
mRecyclerView = (RecyclerView) findViewById(R.id.rv_post_search);
mLayoutManager = new StaggeredGridLayoutManager(SPAN_COUNT, StaggeredGridLayoutManager.VERTICAL);
mRecyclerView.setLayoutManager(mLayoutManager);
mSwipeRefreshLayout = findViewById(R.id.scroll_view_search);
mSwipeRefreshLayout.setColorSchemeResources(
android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
mAdapter = new PostViewAdapter(mListener, "search");
mRecyclerView.setAdapter(mAdapter);
mTAGS = getSelectedTags();
initRefreshListener();
initScrollListener();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_search);
toolbar.setSubtitle(mTAGS);
mSwipeRefreshLayout.setRefreshing(true);
new PullPost(0, mPAGE).execute();
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
new AnalyticsUtils().getAnalytics(TAG, mTAGS, "search" ,mFirebaseAnalytics);
}
示例9: 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);
}
示例10: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CharSequence text = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);
if (text != null) {
setContentView(R.layout.activity_process_text);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle(R.string.encode);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setSubtitle(text);
TextView txtMessage = findViewById(R.id.txt_message);
if (Premium.isPremium(this)) {
txtMessage.setVisibility(View.GONE);
} else {
txtMessage.setText(getString(R.string.chance_remaining, getChanceRemaining()));
txtMessage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Premium.upgrade(EncodeAllProcessTextActivity.this);
}
});
}
String input = text.toString();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content, EncodeAllFragment.newInstance(input, true)).commit();
} else {
finish();
}
}
示例11: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CharSequence text = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);
if (text != null) {
setContentView(R.layout.activity_process_text);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTitle(R.string.decode);
toolbar.setSubtitle(text);
TextView txtMessage = findViewById(R.id.txt_message);
if (Premium.isPremium(this)) {
txtMessage.setVisibility(View.GONE);
} else {
txtMessage.setText(getString(R.string.chance_remaining, getChanceRemaining()));
txtMessage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Premium.upgrade(DecodeAllProcessTextActivity.this);
}
});
}
String input = text.toString();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content, DecodeAllFragment.newInstance(input, true)).commit();
} else {
finish();
}
}
示例12: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CharSequence text = getIntent().getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT);
if (text != null) {
setContentView(R.layout.activity_process_text);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle(R.string.stylish_it);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toolbar.setSubtitle(text);
TextView txtMessage = findViewById(R.id.txt_message);
if (Premium.isPremium(this)) {
txtMessage.setVisibility(View.GONE);
} else {
txtMessage.setText(getString(R.string.chance_remaining, getChanceRemaining()));
txtMessage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Premium.upgrade(StylishProcessTextActivity.this);
}
});
}
String input = text.toString();
FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.content, StylistProcessTextFragment.newInstance(input)).commit();
} else {
finish();
}
}
示例13: onCreate
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_barcode);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle(R.string.barcode);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
String text = getIntent().getStringExtra("data");
if (text == null) text = "";
toolbar.setSubtitle(text);
ViewPager viewPager = findViewById(R.id.view_pager);
viewPager.setAdapter(new BarcodeEncodedPagerAdapter(getSupportFragmentManager(), text));
viewPager.setOffscreenPageLimit(3);
viewPager.setCurrentItem(8); //barcode
((TabLayout) findViewById(R.id.tab_layout)).setupWithViewPager(viewPager);
if (Premium.isPremium(this)){
View containerAd = findViewById(R.id.ads_wrapper);
if (containerAd != null) containerAd.setVisibility(View.GONE);
}else {
AdsManager.loadAds(this, findViewById(R.id.ads_wrapper), findViewById(R.id.ad_view));
}
}
示例14: onViewCreated
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
bindView(view);
Toolbar toolbar = view.findViewById(R.id.toolbar);
toolbar.setTitle("Detail Mahasiswa");
toolbar.setSubtitle(mahasiswa.Nama);
toolbar.inflateMenu(R.menu.detail_menu);
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.detail_hapus:
callback.onDelete(mahasiswa);
getDialog().dismiss();
break;
case R.id.detail_edit:
callback.onEdit(mahasiswa);
getDialog().dismiss();
break;
}
return false;
}
});
}
示例15: initToolBar
import android.support.v7.widget.Toolbar; //导入方法依赖的package包/类
private void initToolBar() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle(null);
toolbar.setSubtitle("科学计算");
ActionBar actionBar = getSupportActionBar();
actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
}