当前位置: 首页>>代码示例>>Java>>正文


Java TextView.setTextIsSelectable方法代码示例

本文整理汇总了Java中android.widget.TextView.setTextIsSelectable方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.setTextIsSelectable方法的具体用法?Java TextView.setTextIsSelectable怎么用?Java TextView.setTextIsSelectable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.setTextIsSelectable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import android.widget.TextView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                         @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_description, container, false);

    mTitleView = (TextView) rootView.findViewById(R.id.title);
    mSummaryView = (TextView) rootView.findViewById(R.id.summary);

    if (Utils.isTv(getActivity())) {
        mSummaryView.setFocusable(true);
    } else {
        mTitleView.setTextIsSelectable(true);
        mSummaryView.setTextIsSelectable(true);
    }

    mSummaryView.setSelected(true);
    mSummaryView.setMovementMethod(LinkMovementMethod.getInstance());

    mTitle = getArguments().getCharSequence("title");
    mSummary = getArguments().getCharSequence("summary");

    refresh();
    return rootView;
}
 
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:26,代码来源:DescriptionFragment.java

示例2: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    ButterKnife.bind(this);

    toolbar.setTitle("关于  v " + PackageUtil.getAppPackageInfo(this).versionName);
    setSupportActionBar(toolbar);

    TextView alipay = (TextView) findViewById(R.id.alipay);
    alipay.setTextIsSelectable(true);
    alipay.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!AliPayUtil.goAliPay(AboutActivity.this))
                SnackbarUtils.Short(getWindow().getDecorView(), "设备上没有安装支付宝").danger().show();
        }
    });
}
 
开发者ID:lanyuanxiaoyao,项目名称:PicKing,代码行数:21,代码来源:AboutActivity.java

示例3: displayLog

import android.widget.TextView; //导入方法依赖的package包/类
private void displayLog() {
    TextView textView = (TextView) findViewById(R.id.yaaccLog_content);

    try {
        Process process = Runtime.getRuntime().exec("logcat -d");
        BufferedReader bufferedReader = new BufferedReader(
                new InputStreamReader(process.getInputStream()));

        StringBuilder log = new StringBuilder();
        String line = "";
        while ((line = bufferedReader.readLine()) != null) {
            log.insert(0,"\n");
            log.insert(0,line);
        }

        textView.setText(log.toString());
        textView.setTextIsSelectable(true);


    } catch (IOException e) {
        textView.setText("Error while reading log: " + e.getMessage());
    }
}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:24,代码来源:YaaccLogActivity.java

示例4: resolveTextSelection

import android.widget.TextView; //导入方法依赖的package包/类
private void resolveTextSelection(){
    if(nonNull(mText)){
        mText.setTextIsSelectable(mTextSelectionAllowed);
    }

    ViewGroup copiesRoot = mAttachmentsViews.getVgPosts();

    for(int i = 0; i < copiesRoot.getChildCount(); i++){
        ViewGroup copyRoot = (ViewGroup) copiesRoot.getChildAt(i);
        TextView textView = copyRoot.findViewById(R.id.item_post_copy_text);
        if(nonNull(textView)){
            textView.setTextIsSelectable(mTextSelectionAllowed);
        }
    }
}
 
开发者ID:PhoenixDevTeam,项目名称:Phoenix-for-VK,代码行数:16,代码来源:WallPostFragment.java

示例5: addTextForAyah

import android.widget.TextView; //导入方法依赖的package包/类
private void addTextForAyah(String[] translations, QuranAyahInfo ayah) {
  LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
      LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  params.setMargins(leftRightMargin, topBottomMargin, leftRightMargin, topBottomMargin);

  final int suraNumber = ayah.sura;
  final int ayahNumber = ayah.ayah;
  TextView ayahHeader = new TextView(context);
  ayahHeader.setTextColor(Color.WHITE);
  ayahHeader.setTextSize(fontSize);
  ayahHeader.setTypeface(null, Typeface.BOLD);
  ayahHeader.setText(resources.getString(R.string.sura_ayah, suraNumber, ayahNumber));
  linearLayout.addView(ayahHeader, params);

  TextView ayahView = new TextView(context);
  ayahView.setTextAppearance(context, textStyle);
  ayahView.setTextColor(Color.WHITE);
  ayahView.setTextSize(fontSize);

  // translation
  boolean showHeader = translations.length > 1;
  SpannableStringBuilder builder = new SpannableStringBuilder();
  for (int i = 0; i < translations.length; i++) {
    String translationText = ayah.texts.get(i);
    if (!TextUtils.isEmpty(translationText)) {
      if (showHeader) {
        if (i > 0) {
          builder.append("\n\n");
        }
        int start = builder.length();
        builder.append(translations[i]);
        builder.setSpan(new StyleSpan(Typeface.BOLD),
            start, builder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        builder.append("\n\n");
      }
      builder.append(translationText);
    }
  }
  ayahView.append(builder);

  params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
  params.setMargins(leftRightMargin, topBottomMargin, leftRightMargin, topBottomMargin);
  ayahView.setTextIsSelectable(true);
  linearLayout.addView(ayahView, params);
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:46,代码来源:InlineTranslationView.java


注:本文中的android.widget.TextView.setTextIsSelectable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。