本文整理匯總了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));
}