androidx.preference.Preference.getTitle()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中androidx.preference.Preference.getTitle()方法的一些代码示例,展示了Preference.getTitle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Preference.getTitle()方法的具体详情如下:
包路径:androidx.preference.Preference
类名称:Preference
方法名:getTitle

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);

相关文章