當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。