本文整理了Java中androidx.preference.Preference.getTitle()
方法的一些代码示例,展示了Preference.getTitle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Preference.getTitle()
方法的具体详情如下:
包路径:androidx.preference.Preference
类名称:Preference
方法名:getTitle
暂无
代码示例来源:origin: michael-rapp/AndroidPreferenceActivity
/**
* The method, which is invoked, when a specific preference is visualized. This method may be
* overridden by subclasses in order to modify the appearance of the preference.
*
* @param preference
* The preference, which is visualized, as an instance of the class Preference. The
* preference may not be null
* @param viewHolder
* The view holder, which corresponds to the preference, as an instance of the class
* PreferenceViewHolder. The view holder may not be null
*/
@CallSuper
protected void onVisualizePreference(@NonNull final Preference preference,
@NonNull final PreferenceViewHolder viewHolder) {
if (preference instanceof PreferenceCategory) {
RecyclerView.LayoutParams layoutParams =
(RecyclerView.LayoutParams) viewHolder.itemView.getLayoutParams();
layoutParams.height = TextUtils.isEmpty(preference.getTitle()) ? 0 :
RecyclerView.LayoutParams.WRAP_CONTENT;
}
}
代码示例来源:origin: 8enet/AppOpsX
@Override
public boolean onPreferenceClick(Preference preference) {
String key = preference.getKey();
if ("opensource_licenses".equals(key)) {
Intent intent = new Intent(getContext(), HtmlActionActivity.class);
intent.putExtra(Intent.EXTRA_TITLE, preference.getTitle());
intent.putExtra(HtmlActionActivity.EXTRA_URL, "file:///android_res/raw/licenses.html");
getActivity().startActivity(intent);
} else if ("help".equals(key)) {
Intent intent = new Intent(getContext(), HtmlActionActivity.class);
intent.putExtra(Intent.EXTRA_TITLE, preference.getTitle());
intent.putExtra(HtmlActionActivity.EXTRA_URL, "file:///android_res/raw/help.html");
getActivity().startActivity(intent);
} else if ("pref_app_language".equals(key)) {
showLanguageDialog(preference);
} else if ("shell_start".equals(key)){
showShellStart();
}
return false;
}
}
代码示例来源:origin: bfabiszewski/ulogger-android
preference.getTitle(),
R.layout.other_dialog);
final TextView textView = dialog.findViewById(R.id.other_textview);
内容来源于网络,如有侵权,请联系作者删除!