本文整理汇总了Java中android.support.design.widget.CollapsingToolbarLayout.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java CollapsingToolbarLayout.setTitle方法的具体用法?Java CollapsingToolbarLayout.setTitle怎么用?Java CollapsingToolbarLayout.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.design.widget.CollapsingToolbarLayout
的用法示例。
在下文中一共展示了CollapsingToolbarLayout.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_about);
setSupportActionBar(toolbar);
actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
textView = (TextView) findViewById(R.id.tv_description);
textView.setText("Projeto de Extensão do Instituto Federal de Pernambuco - Campus Igarassu\n\n"+
"Desenvolvedores:\n" +
"Gabriel Lima Gonçalves da Silva\n" +
"José Gabriel Vicente das Neves da Silva\n\n" +
"Orientador:\n" +
"Allan Diego Silva Lima\n");
collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbarLayout.setTitle("Sobre");
toolbarTextAppearance();
}
示例2: onCreate
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fruit);
Intent intent = getIntent();
String fruitName = intent.getStringExtra(FRUIT_NAME);
int fruitImageId = intent.getIntExtra(FRUIT_IMAGE_ID, 0);
String fruitinfo = intent.getStringExtra(FRUIT_INFO);
byte[] in = intent.getByteArrayExtra(FRUIT_IMAGE);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
ImageView fruitImageView = (ImageView) findViewById(R.id.fruit_image_view);
TextView fruitContentText = (TextView) findViewById(R.id.fruit_content_text);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
collapsingToolbar.setTitle(fruitName);
if(fruitImageId==0)
{
Bitmap fruitimage = BitmapFactory.decodeByteArray(in, 0, in.length);
fruitImageView.setImageBitmap(fruitimage);
}
else Glide.with(this).load(fruitImageId).into(fruitImageView);
String fruitContent = generateFruitContent(fruitinfo);
fruitContentText.setText(fruitContent);
}
示例3: onCreate
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_suggestion);
Intent intent=getIntent();
Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
CollapsingToolbarLayout collapsingToolbarLayout=(CollapsingToolbarLayout)findViewById(R.id.collapsing_toolbar);
ImageView fruitImageView=(ImageView)findViewById(R.id.fruit_image_view);
TextView fruitContentText=(TextView)findViewById(R.id.fruit_content_text);
setSupportActionBar(toolbar);
ActionBar actionBar=getSupportActionBar();
if (actionBar!=null){
actionBar.setDisplayHomeAsUpEnabled(true);
}
collapsingToolbarLayout.setTitle("苹果雪松生锈-雪松苹果锈病菌");
Glide.with(this).load(R.drawable.disease_pic1).into(fruitImageView);
fruitContentText.setText("危害性状 危害苹果属、刺柏属。在刺柏的细枝、分枝和叶上产生菌痪,或在茎部引起纺锤形肿胀,在潮湿条件下可产生冬孢子角。在锈子器寄主上,锈子器引起的叶片症状和性孢子器引起的症状是一致的。能在感病品种上造成非常严重的落叶。偶尔能在苹果表面引起褐色坏死斑。\n" +
"\n" +
"生物特性 冬孢子堆在枝条边上的球形或肾形,直径1-3cm的菌瘿上形成,长圆柱形,逐渐变细,长10-20mm,宽1-2mm,锈褐色。冬孢子:双细胞,圆柱形至拟纺锤形。15-21μm× 35-65μm,壁厚0.5-1μm。在蔷薇科寄主上,锈子器:毛型锈子器为叶背生,具包被,高3-5mm。在顶端开裂。锈孢子团为红褐色。锈孢子:直径15-28μm。 转主寄生,需要刺柏属和蔷薇科寄主来完成它的生活史。春季,冬孢子堆产生在刺柏属的茎、嫩枝和叶上。在潮湿条件下,冬孢子萌发并产生担孢子,担孢子飞散再侵染邻近的蔷薇科寄主。担孢子侵染蔷薇科寄主的叶的上表面,产生性孢子器;在春末到初夏季节用肉眼即可看到,随后,在叶背部的管状保护鞘(包被)内产生夏孢子。夏孢子堆以独特的形式出现在果实上。据推侧,侵染果实的病菌可能是其他的种。当包被破裂时,夏孢子即被释放,并随风作长距离传播至刺柏属寄主上。在刺柏属上萌发后,产生越冬的潜伏菌丝。受侵染的叶或果实脱落后,对蔷薇科寄主的侵染便不能继续。春天,冬孢子阶段出现在刺柏属上,开始下一轮生活史。\n" +
"\n" +
"传染途径 在自然条件下通过蔷薇科寄主上的担孢子传播,也可通过刺柏属寄主上的锈孢子风传。远距离传播主要借助染病的植株体(特别是用其做包装材料时)等。\n" +
"\n" +
"防疫方法 由于病菌可系统地侵染桧柏的茎和常绿的叶,因此没有一种化学处理方法能取得令人满意的效果。有人提出应用放线菌酮来抑制雪松-苹果锈病菌的冬孢子产生,这项措施可作为对受侵染植物的短期检疫处理方法以防植物死亡。冬孢子极可能由受侵染植物制成的包装材料携带。");
}
示例4: initializeToolbar
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
private void initializeToolbar() {
final CollapsingToolbarLayout collapsingToolbar =
(CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle("");
Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("");
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
示例5: onCreate
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments().containsKey(ARG_ITEM_ID)) {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
Activity activity = this.getActivity();
CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
if (appBarLayout != null) {
appBarLayout.setTitle(mItem.content);
}
}
}
示例6: setupCollapsingImage
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
private void setupCollapsingImage() {
appBarLayout = (AppBarLayout) findViewById(R.id.app_bar_layout);
//Fade out CollapsingToolbarLayout title ...from white to transparent
collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
Typeface type = Typeface.createFromAsset(getAssets(), "fonts/open_sans/OpenSans-Light.ttf");
collapsingToolbarLayout.setExpandedTitleTypeface(type);//fonts
collapsingToolbarLayout.setCollapsedTitleTypeface(type);
collapsingToolbarLayout.setTitle(getString(R.string.pod));
collapsingToolbarLayout.setExpandedTitleColor(getResources().getColor(R.color.white_opacity));
collapsingToolbarLayout.setCollapsedTitleTextColor(getResources().getColor(R.color.white_opacity_king));
//Set Picture of the day to collapsing ImageView
collapsingImageView = (ImageView) findViewById(R.id.collapsing_ImageView);
pictureOfTheDayList = storage.retrieveRSS_Feed(MediaType.PICTURE);
if (pictureOfTheDayList != null &&
pictureOfTheDayList.size() > 0 &&
pictureOfTheDayList.get(0) != null &&
pictureOfTheDayList.get(0).getMediaLink() != null)
Glide.with(this)
.load(pictureOfTheDayList.get(0).getMediaLink())
.centerCrop()
.into(collapsingImageView);
}
示例7: onCreate
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_news_detail);
prefManager = new PrefManager(getApplicationContext());
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final android.support.v7.app.ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle("");
imgPreview = (ImageView) findViewById(R.id.imgPreview);
txtText = (TextView) findViewById(R.id.txtText);
txtSubText = (TextView) findViewById(R.id.txtSubText);
txtDescription = (WebView) findViewById(R.id.txtDescription);
coordinatorLayout = (CoordinatorLayout) findViewById(R.id.main_content);
prgLoading = (ProgressBar) findViewById(R.id.prgLoading);
txtAlert = (TextView) findViewById(R.id.txtAlert);
Intent iGet = getIntent();
Product_ID = iGet.getLongExtra("product_id", 0);
NewsDetailAPI = HackConstants.NewsDetailAPI +"?accesskey="+ HackConstants.AccessKey+"&product_id="+ Product_ID;
com.github.clans.fab.FloatingActionButton fabShare = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.share);
fabShare.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent sendInt = new Intent(Intent.ACTION_SEND);
sendInt.putExtra(Intent.EXTRA_SUBJECT, Product_name);
sendInt.putExtra(Intent.EXTRA_TEXT, Product_description + "\n" + Product_image + "\n");
sendInt.setType("text/plain");
startActivity(Intent.createChooser(sendInt, "Хуваалцах"));
}
});
}
示例8: onCreate
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
CollapsingToolbarLayout collapsingToolbar =
(CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle("哆啦A梦");
RecyclerView mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mRecyclerView.setLayoutManager(new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL));
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setAdapter(new RecyclerViewAdapter(CollapsingToolbarActivity.this));
}
示例9: updateChannelView
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
public void updateChannelView(String title) {
if (title != null) {
CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
if (appBarLayout != null) {
appBarLayout.setTitle(title);
} else if (getSupportActionBar() != null) {
getSupportActionBar().setTitle(title);
getSupportActionBar().setHomeButtonEnabled(true);
}
}
}
示例10: initSelfView
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
private void initSelfView() {
toolbar = (Toolbar) findViewById(R.id.sheet_detail_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
toTop = (FloatingActionButton) findViewById(R.id.sheet_detail_top);
initToTopPos();
songList = (RecyclerView) findViewById(R.id.sheet_detail_songs_list);
appBarLayout = (AppBarLayout) findViewById(R.id.sheet_detail_app_bar);
collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.sheet_detail_toolbar_layout);
barStateChangeListener = new AppBarStateChangeListener() {
@Override
public void onStateChanged(AppBarLayout appBarLayout, State state) {
switch (state) {
case EXPANDED:
collapsingToolbarLayout.setTitle(" ");
songList.setNestedScrollingEnabled(false);
transToTopBt(true);
break;
case COLLAPSED:
collapsingToolbarLayout.setTitle(infoController.getTitle());
songList.setNestedScrollingEnabled(true);
toTop.setVisibility(View.VISIBLE);
transToTopBt(false);
break;
case IDLE:
collapsingToolbarLayout.setTitle(" ");
break;
}
}
};
appBarLayout.addOnOffsetChangedListener(barStateChangeListener);
}
示例11: initData
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
public void initData() {
CollapsingToolbarLayout collapsingToolbarLayout = findViewById(R.id.collapsing_toolbar_layout);
Toolbar toolbar = findViewById(R.id.general_info_toolbar);
CardView cardView = findViewById(R.id.InfoActivity_card);
imageView = findViewById(R.id.general_info_image);
floatingActionButton = findViewById(R.id.general_info_fab);
radioGroup = findViewById(R.id.radiogroup);
buttons[0] = findViewById(R.id.radiogroup_others);
buttons[1] = findViewById(R.id.radiogroup_man);
buttons[2] = findViewById(R.id.radiogroup_woman);
nameEditText = findViewById(R.id.general_info_name_content);
ageEditText = findViewById(R.id.general_info_age_and_sex_content);
countryEditText = findViewById(R.id.general_info_country_content);
moreInfoEditText = findViewById(R.id.general_info_more_content);
setSupportActionBar(toolbar);
collapsingToolbarLayout.setTitle(" ");
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
imageView.setOnClickListener(this);
floatingActionButton.setOnClickListener(this);
//信息卡片只会出现一次
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (prefs.getBoolean("INFO_ACTIVITY_CARD", false)) {
cardView.setVisibility(View.GONE);
}
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
editor.putBoolean("INFO_ACTIVITY_CARD", true);
editor.apply();
}
示例12: onCreateView
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_expenses_list, container, false);
CollapsingToolbarLayout appBarLayout = getActivity().findViewById(R.id.toolbar_layout);
appBarLayout.setTitle(getResources().getString(R.string.title_expenses));
loadingBar = view.findViewById(R.id.expense_list_loading);
emptyList = view.findViewById(R.id.expense_list_empty);
addButton = getActivity().findViewById(R.id.fab_add);
addButton.setVisibility(View.VISIBLE);
addButton.setOnClickListener(this);
recyclerView = view.findViewById(R.id.expense_list);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.addItemDecoration(new DividerItemDecoration(recyclerView.getContext(),
((LinearLayoutManager) recyclerView.getLayoutManager()).getOrientation()));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(adapter);
getLoaderManager().initLoader(EXPENSE_LOADER_ID, null, this);
return view;
}
示例13: onCreate
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Set Collapsing Toolbar layout to the screen
CollapsingToolbarLayout collapsingToolbar =
(CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
// Set title of Detail page
// collapsingToolbar.setTitle(getString(R.string.item_title));
int postion = getIntent().getIntExtra(EXTRA_POSITION, 0);
Resources resources = getResources();
String[] places = resources.getStringArray(R.array.places);
collapsingToolbar.setTitle(places[postion % places.length]);
String[] placeDetails = resources.getStringArray(R.array.place_details);
TextView placeDetail = (TextView) findViewById(R.id.place_detail);
placeDetail.setText(placeDetails[postion % placeDetails.length]);
String[] placeLocations = resources.getStringArray(R.array.place_locations);
TextView placeLocation = (TextView) findViewById(R.id.place_location);
placeLocation.setText(placeLocations[postion % placeLocations.length]);
TypedArray placePictures = resources.obtainTypedArray(R.array.places_picture);
ImageView placePicutre = (ImageView) findViewById(R.id.image);
placePicutre.setImageDrawable(placePictures.getDrawable(postion % placePictures.length()));
placePictures.recycle();
}
示例14: onCreate
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceStatus) {
Log.d(TAG, "onCreate()");
setContentView(R.layout.activity_show_categories);
super.onCreate(savedInstanceStatus);
// Setup Toolbar
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
try {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
} catch (NullPointerException e) {
Log.e("TAG", e.toString());
}
TextView howDoesItWorkRoutesTitleDescription = (TextView) findViewById(R.id.howDoesItWorkRoutesTitleDescription);
howDoesItWorkRoutesTitleDescription.setText(Html.fromHtml(getString(R.string.categories_how_does_it_work_description)));
// Setup Name
final String screenName = getString(R.string.menu_categories);
CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle(screenName);
// Maybe there is an active category?
SharedPreferences sharedpreferences = getSharedPreferences(Utils.AtSharedPreference, MODE_PRIVATE);
Integer categoryIdSelected = sharedpreferences.getInt(Utils.keyCurrentCategoryId, 0); //0 is the default value.
NestedScrollView nestedScrollViewListPoint = (NestedScrollView) findViewById(R.id.nestedScrollCategories);
CoordinatorLayout.LayoutParams layoutParams = new CoordinatorLayout.LayoutParams(CoordinatorLayout.LayoutParams.MATCH_PARENT, CoordinatorLayout.LayoutParams.MATCH_PARENT);
TextView textViewCategoryFilterTitle = (TextView) findViewById(R.id.textViewCategoryFilterTitle);
// MarginLayoutParams nestedLayoutParams = null;
if( categoryIdSelected != 0 ) {
// Convert PX -> DP
int marginTop = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
40,
getResources().getDisplayMetrics()
);
AtCategory atCategory = AtUtils.getCategory(categoryIdSelected, this);
layoutParams.setMargins(0, marginTop, 0, 0);
layoutParams.setBehavior(new AppBarLayout.ScrollingViewBehavior()); // Do i REALLY need to re-define the behaviour? :-|
nestedScrollViewListPoint.setLayoutParams(layoutParams);
String newFilterTitle = getString(R.string.list_filter_category) + atCategory.getName();
textViewCategoryFilterTitle.setText(newFilterTitle);
textViewCategoryFilterTitle.setVisibility(View.VISIBLE);
} else {
layoutParams.setMargins(0, 0, 0, 0);
layoutParams.setBehavior(new AppBarLayout.ScrollingViewBehavior()); // Do i REALLY need to re-define the behaviour? :-|
nestedScrollViewListPoint.setLayoutParams(layoutParams);
textViewCategoryFilterTitle.setText("");
textViewCategoryFilterTitle.setVisibility(View.GONE);
}
dbCatConverter = new HashMap<Integer, String>();
// FIXME: Ugly as hell, but hey, time's up :-(
atCategories = AtUtils.getAllCategories(getApplicationContext());
Log.d(TAG, "CATEGORIES: " + atCategories.toString());
for (final AtCategory singleCategory : atCategories) {
if(singleCategory != null) {
dbCatConverter.put(singleCategory.getIdCategory(), singleCategory.getName());
}
}
loadBackdrop(R.id.backdrop, R.drawable.header_categories);
}
示例15: initCollapsingToolbar
import android.support.design.widget.CollapsingToolbarLayout; //导入方法依赖的package包/类
@Override
protected void initCollapsingToolbar(CollapsingToolbarLayout layout) {
layout.setTitle(getContext().getResources().getString(R.string.home));
layout.setContentScrimResource(R.color.colorPrimary);
layout.setExpandedTitleColor(getContext().getResources().getColor(R.color.transparent));
}