本文整理匯總了Java中android.support.v7.app.ActionBar.setTitle方法的典型用法代碼示例。如果您正苦於以下問題:Java ActionBar.setTitle方法的具體用法?Java ActionBar.setTitle怎麽用?Java ActionBar.setTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.app.ActionBar
的用法示例。
在下文中一共展示了ActionBar.setTitle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//set up databaseOpenHelper and Retrofit objects.
mAPI = ApiUtils.getServerAPI();
dbHelper = new DatabaseOpenHelper(getContext());
sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());
//fetch data from online JSON if it is not updated
if(!sharedPref.getBoolean(getString(R.string.updated_database), false)) {
getDataFromJSON();
}
ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
actionBar.show();
actionBar.setTitle(R.string.home);
}
}
示例2: selectFavoriteProject
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void selectFavoriteProject() {
if (!mNoProject) {
mSelectedProfileIndex = getIndexOfFavorite();
IProfile activeProfile = mProfiles.get(mSelectedProfileIndex);
String activeProfileName = activeProfile.getName().getText();
ActionBar bar;
if ((bar = getSupportActionBar()) != null) {
bar.setTitle(activeProfileName);
}
DataEntry.setTableName(activeProfileName);
switchToProjectColors();
}
}
示例3: onResume
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onResume() {
super.onResume();
ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
if (actionBar != null) {
actionBar.setTitle(R.string.create_album);
actionBar.setSubtitle(null);
}
new ActivityFeatures.Builder()
.begin()
.setBlockNavigationDrawer(true)
.setStatusBarColored(true)
.build()
.apply(getActivity());
}
示例4: onCreate
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sensor_list);
ActionBar bar = getSupportActionBar();
bar.setTitle(R.string.actionbar_list);
sensorListener = new SensorListener(this, sensorInfos);
userInfo = UserInfo.getInstance(this);
oneM2MWorker = OneM2MWorker.getInstance();
oneM2MWorker.setStateListener(new OneM2MWorkerListener());
googleDriveHandler = new GoogleDriveHandler(this, new GoogleDriveCommandListener());
googleDriveHandler.connect();
// create sensor list
createSensorList();
}
示例5: onCreate
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_root);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
final ActionBar supportActionBar = getSupportActionBar();
final Team team = getIntent().getExtras().getParcelable(ARG_TEAM);
supportActionBar.setTitle(team.getName());
supportActionBar.setSubtitle(getString(R.string.messages_subtitle));
supportActionBar.setDisplayHomeAsUpEnabled(true);
inflateFragment(team);
}
示例6: initUIAndData
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void initUIAndData() {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(mUri.toString().substring(mUri.toString().lastIndexOf(File.separator) + 1));
mContainer = (ViewGroup) findViewById(R.id.container);
mProgressBar = (ProgressBar) findViewById(R.id.progress);
mWXHandler = new Handler(this);
HotRefreshManager.getInstance().setHandler(mWXHandler);
addOnListener();
}
示例7: onResume
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onResume() {
super.onResume();
ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
if (actionBar != null) {
actionBar.setTitle(R.string.share);
actionBar.setSubtitle(null);
}
}
示例8: onCreate
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
super.onCreate(savedInstanceState);
String title=getIntent().getStringExtra("title");
if (TextUtils.isEmpty(title))
title=getString(R.string.app_name);
ActionBar bar=getSupportActionBar();
bar.setTitle(title);
if (!title.equals(getString(R.string.app_name)))
bar.setDisplayHomeAsUpEnabled(true);
}
示例9: setToolbarTitle
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void setToolbarTitle(@StringRes int titleRes, Object... params) {
ActionBar actionBar = ActivityUtils.supportToolbarFor(this);
if (Objects.nonNull(actionBar)) {
actionBar.setTitle(getString(titleRes, params));
}
}
示例10: initView
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void initView(Bundle savedInstanceState) {
if (mToolbar != null) {
setSupportActionBar(mToolbar);
ActionBar mActionBar = getSupportActionBar();
if (mActionBar != null) {
mActionBar.setDisplayHomeAsUpEnabled(true);
mActionBar.setTitle("編輯商機");
}
}
showLoading();
}
示例11: onCreate
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vod_player);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle("VOD");
actionBar.setDisplayHomeAsUpEnabled(true);
}
ijkVideoView = findViewById(R.id.player);
// int widthPixels = getResources().getDisplayMetrics().widthPixels;
// ijkVideoView.setLayoutParams(new LinearLayout.LayoutParams(widthPixels, widthPixels / 16 * 9));
List<VideoModel> videos = new ArrayList<>();
videos.add(new VideoModel(URL_AD, "廣告", new AdController(this)));
videos.add(new VideoModel(URL_VOD, "這是一個標題", new StandardVideoController(this)));
ijkVideoView
.setVideos(videos)
// .autoRotate()
// .enableCache()
// .useSurfaceView()
// .useAndroidMediaPlayer()
// .setUrl(URL_VOD)
// .setTitle("網易公開課-如何掌控你的自由時間")
.start();
}
示例12: loadToolbar
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void loadToolbar(final Book book) {
if (getActivity() != null) {
ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(book.getVolumeInfo().getTitle());
actionBar.setSubtitle(book.getVolumeInfo().getAuthors() != null ? book.getVolumeInfo().getAuthors().get(0) : "");
}
}
}
示例13: onShow
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
@Override
public void onShow(String title) {
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(title);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowHomeEnabled(true);
}
}
示例14: init
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void init(View view) {
ButterKnife.bind(this, view);
activity = (AppCompatActivity) getActivity();
activity.setSupportActionBar(toolbar);
ActionBar actionBar = activity.getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle(fragmentTitle);
}
recyclerView.setHasFixedSize(true);
recyclerView.setMotionEventSplittingEnabled(false);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(movieListAdapter);
recyclerView.setLayoutManager(setUpLayoutManager());
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.addOnScrollListener(setupScrollListener(recyclerView.getLayoutManager()));
tryAgainBtn.setOnClickListener(v -> {
switch (ID) {
case 1:
if (movieListAdapter.isEmpty()) {
movieListPresenter.mostPopularListRequested();
}
break;
case 2:
if (movieListAdapter.isEmpty()) {
movieListPresenter.onTopRatedMoviesRequested();
}
break;
case 3:
if (movieListAdapter.isEmpty()) {
movieListPresenter.onBoxOfficeRequested();
}
break;
case 4:
if(movieListAdapter.isEmpty()) {
movieListPresenter.onPopularMovieByGenreRequested(genreId);
}
break;
}
});
}
示例15: setActionBarTitle
import android.support.v7.app.ActionBar; //導入方法依賴的package包/類
private void setActionBarTitle(String title) {
ActionBar actionBar = ((NavigationDrawerActivity) getActivity()).getSupportActionBar();
if (actionBar != null) {
actionBar.setTitle(title);
}
}