本文整理了Java中android.app.Activity.setTitle()
方法的一些代码示例,展示了Activity.setTitle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.setTitle()
方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:setTitle
暂无
代码示例来源:origin: square/dagger
public void setTitle(CharSequence title) {
activity.setTitle(title);
}
}
代码示例来源:origin: cymcsg/UltimateAndroid
@Override
public void onReceivedTitle(WebView view, String title) {
((Activity) mContext).setTitle(title);
}
代码示例来源:origin: stackoverflow.com
getWindow().requestFeature(Window.FEATURE_PROGRESS);
WebView mWebView = (WebView) findViewById(R.id.mywebview);
mWebView.getSettings().setJavaScriptEnabled(true);
final Activity activity = this;
mWebView.setWebChromeClient(new WebChromeClient(){
public void onProgressChanged(WebView view, int progress) {
activity.setTitle("Loading...");
activity.setProgress(progress * 100);
if(progress == 100)
activity.setTitle("My title");
}
});
mWebView.loadUrl(URL);
代码示例来源:origin: stackoverflow.com
mActivity .setTitle("Loading...");
mActivity .setProgress(progress * 100); //Make the bar disappear after URL is loaded
代码示例来源:origin: stackoverflow.com
mActivity.setTitle(mModes[mModeIndex].toString());
代码示例来源:origin: com.uphyca/android-junit4-robolectric
/**
* @param titleId
* @see android.app.Activity#setTitle(int)
*/
public void setTitle(int titleId) {
mActivity.setTitle(titleId);
}
代码示例来源:origin: limpoxe/Android-Plugin-Framework
activity.setTitle(activity.getClass().getName());
代码示例来源:origin: ximsfei/Android-plugin-support
private void changeTitle(DynamicApkParser.Activity a, Activity activity) {
if (a.info.labelRes != 0) {
activity.setTitle(a.owner.resources.getString(a.info.labelRes));
} else if (a.owner.applicationInfo.nonLocalizedLabel != null) {
activity.setTitle(a.owner.applicationInfo.nonLocalizedLabel);
} else if (a.owner.applicationInfo.labelRes != 0) {
activity.setTitle(a.owner.resources.getString(a.owner.applicationInfo.labelRes));
}
}
}
代码示例来源:origin: stackoverflow.com
Activity activity = this.getActivity();
Toolbar toolbar = (Toolbar) activity.findViewById(R.id.detail_toolbar);
if (toolbar != null) {
activity.setTitle("Title");
}
//toolbar.setTitle("Title"); did not give the same results
代码示例来源:origin: Werb/GankWithZhihu
@Override
public void onReceivedTitle(WebView view, String title) {
System.out.println("网页title:"+title);
activity.setTitle(title);
super.onReceivedTitle(view, title);
}
});
代码示例来源:origin: werbhelius/Werb
@Override
public void onReceivedTitle(WebView view, String title) {
System.out.println("网页title:"+title);
activity.setTitle(title);
super.onReceivedTitle(view, title);
}
});
代码示例来源:origin: com.sdklite/sphere-hybrid-spi
@Override
public void onReceivedTitle(final WebView view, final String title) {
final Context context = view.getContext();
if (context instanceof Activity) {
((Activity) context).setTitle(title);
}
}
代码示例来源:origin: YarikSOffice/LanguageTest
public static void resetActivityTitle(Activity a) {
try {
ActivityInfo info = a.getPackageManager().getActivityInfo(a.getComponentName(), GET_META_DATA);
if (info.labelRes != 0) {
a.setTitle(info.labelRes);
}
} catch (NameNotFoundException e) {
e.printStackTrace();
}
}
代码示例来源:origin: derry/delion
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.legal_information_preferences);
getActivity().setTitle(R.string.legal_information_title);
}
}
代码示例来源:origin: AndBible/and-bible
public static void translateTitle(Activity activity) {
if (isLocaleOverridden(activity)) {
// http://stackoverflow.com/questions/22884068/troubles-with-activity-title-language
try {
int labelRes = activity.getPackageManager().getActivityInfo(activity.getComponentName(), 0).labelRes;
activity.setTitle(labelRes);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: wasdennnoch/AndroidN-ify
@Override
public void onResume() {
super.onResume();
getActivity().setTitle(getArguments().getString(TITLE));
}
代码示例来源:origin: wirasetiawan29/Android
/**
* Updates the state of 2 control buttons in response to the current page index.
*/
private void updateUi() {
int index = mCurrentPage.getIndex();
int pageCount = mPdfRenderer.getPageCount();
mButtonPrevious.setEnabled(0 != index);
mButtonNext.setEnabled(index + 1 < pageCount);
getActivity().setTitle(getString(R.string.app_name_with_index, index + 1, pageCount));
}
代码示例来源:origin: derry/delion
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.physical_web_preferences);
getActivity().setTitle(R.string.physical_web_pref_title);
initPhysicalWebSwitch();
initLaunchButton();
}
代码示例来源:origin: wasdennnoch/AndroidN-ify
@Override
public void onResume() {
super.onResume();
getPreferenceManager().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
if (mShowExperimental != ConfigUtils.showExperimental(ConfigUtils.getPreferences(getActivity()))) {
getActivity().recreate();
} else {
getActivity().setTitle(R.string.app_name);
}
}
代码示例来源:origin: pylerSM/XInstaller
@Override
public void onStop() {
getActivity().setTitle(oldTitle);
ActionBar ab = getActivity().getActionBar();
if (ab != null && oldTitle.equals(getString(R.string.app_name))) {
ab.setDisplayHomeAsUpEnabled(false);
ab.setHomeButtonEnabled(false);
}
getActivity().invalidateOptionsMenu();
super.onStop();
}
}
内容来源于网络,如有侵权,请联系作者删除!