android.widget.TextView.setTextIsSelectable()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(163)

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

TextView.setTextIsSelectable介绍

暂无

代码示例

代码示例来源:origin: cSploit/android

mOutput.setTextIsSelectable(true);

代码示例来源:origin: huxq17/XRefreshView

private void requestScrllViewData() {
  for (int i = 0; i < 50; i++) {
    TextView tv = new TextView(this);
    tv.setTextSize(16);
    int padding = DensityUtil.dip2px(this, 20);
    tv.setPadding(padding, padding, 0, 0);
    tv.setTextIsSelectable(true);
    tv.setText("数据" + i);
    linearLayout.addView(tv);
  }
}

代码示例来源:origin: stackoverflow.com

// The TextView to show your Text
TextView showText = new TextView(this);
showText.setText("Some selectable text goes here.");
showText.setTextIsSelectable(true);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
// Build the Dialog
builder.setView(showText)
    .setTitle("Selectable text")
    .setCancelable(true)
    .show();

代码示例来源:origin: huxq17/XRefreshView

for (int i = 0; i < 50; i++) {
  TextView tv = new TextView(mContext);
  tv.setTextIsSelectable(true);
  tv.setText("数据" + i);
  ll.addView(tv);

代码示例来源:origin: huxq17/XRefreshView

for (int i = 0; i < 50; i++) {
  TextView tv = new TextView(this);
  tv.setTextIsSelectable(true);
  tv.setText("数据" + i);
  ll.addView(tv);

代码示例来源:origin: sendtion/XRichText

tv_note_title.setTextIsSelectable(true);

代码示例来源:origin: stackoverflow.com

alertDialog.show();
 try {
   TextView textView = (TextView)dialog.getWindow().getDecorView().findViewById(android.R.id.message);
   textView.setTextIsSelectable(true);
 }
 catch(Exception e) {
   // Oups!
 }

代码示例来源:origin: VREMSoftwareDevelopment/WiFiAnalyzer

private void enableTextSelection(View view) {
  view.<TextView>findViewById(R.id.ssid).setTextIsSelectable(true);
  view.<TextView>findViewById(R.id.vendorLong).setTextIsSelectable(true);
}

代码示例来源:origin: oVirt/moVirt

private void deselectLastTextView() {
    if (lastSelectedTextView != null && lastSelectedTextView.hasSelection()) {
      lastSelectedTextView.setTextIsSelectable(false);
      lastSelectedTextView.setTextIsSelectable(true);
    }
  }
}

代码示例来源:origin: li2/learning-android-open-source

public Content(Context context, AttributeSet attrs) {
  super(context, attrs);
  mText = new TextView(context);
  mText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
  mText.setText(context.getString(R.string.alert_dialog_two_buttons2ultra_msg));
  mText.setClickable(false);
  mText.setOnClickListener(this);
  mText.setTextIsSelectable(true);
  addView(mText, new ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  setOnSystemUiVisibilityChangeListener(this);
}

代码示例来源:origin: li2/learning-android-open-source

public Content(Context context, AttributeSet attrs) {
  super(context, attrs);
  mText = new TextView(context);
  mText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
  mText.setText(context.getString(R.string.alert_dialog_two_buttons2ultra_msg));
  mText.setClickable(false);
  mText.setOnClickListener(this);
  mText.setTextIsSelectable(true);
  addView(mText, new ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  setOnSystemUiVisibilityChangeListener(this);
}

代码示例来源:origin: qiubiteme/android_api_demos

public Content(Context context, AttributeSet attrs) {
  super(context, attrs);
  mText = new TextView(context);
  mText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
  mText.setText(context.getString(R.string.alert_dialog_two_buttons2ultra_msg));
  mText.setClickable(false);
  mText.setOnClickListener(this);
  mText.setTextIsSelectable(true);
  addView(mText, new ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  setOnSystemUiVisibilityChangeListener(this);
}

代码示例来源:origin: qiubiteme/android_api_demos

public Content(Context context, AttributeSet attrs) {
  super(context, attrs);
  mText = new TextView(context);
  mText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
  mText.setText(context.getString(R.string.alert_dialog_two_buttons2ultra_msg));
  mText.setClickable(false);
  mText.setOnClickListener(this);
  mText.setTextIsSelectable(true);
  addView(mText, new ViewGroup.LayoutParams(
      ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  setOnSystemUiVisibilityChangeListener(this);
}

代码示例来源:origin: Wilm0r/giggity

@Override
  public boolean onLongClick(View v) {
    v.setFocusable(true);
    ((TextView) v).setTextIsSelectable(true);
    ((TextView) v).setMovementMethod(ArrowKeyMovementMethod.getInstance());
    return false;
  }
});

代码示例来源:origin: wolpi/prim-ftpd

/**
 * Creates table containing network interfaces.
 */
protected void showAddresses() {
  LinearLayout container = (LinearLayout)findViewById(R.id.addressesContainer);
  // clear old entries
  container.removeAllViews();
  List<String> displayTexts = ipAddressProvider.ipAddressTexts(this, true);
  for (String displayText : displayTexts) {
    TextView textView = new TextView(container.getContext());
    container.addView(textView);
    textView.setText(displayText);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setTextIsSelectable(true);
  }
}

代码示例来源:origin: intrications/intent-intercept

private void addTextToLayout(String text, int typeface, int paddingLeft,
    LinearLayout layout) {
  TextView textView = new TextView(this);
  ParagraphStyle style_para = new LeadingMarginSpan.Standard(0,
      (int) (STANDARD_INDENT_SIZE_IN_DIP * density));
  SpannableString styledText = new SpannableString(text);
  styledText.setSpan(style_para, 0, styledText.length(),
      Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
  textView.setText(styledText);
  textView.setTextAppearance(this, R.style.TextFlags);
  textView.setTypeface(null, typeface);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    textView.setTextIsSelectable(true);
  }
  LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
      LayoutParams.WRAP_CONTENT);
  params.setMargins((int) (paddingLeft * density), 0, 0, 0);
  layout.addView(textView, params);
}

代码示例来源:origin: Swati4star/Images-to-PDF

/**
 * Creates a mDialog with details of given PDF file
 *
 * @param file - file name
 */
public void showDetails(File file) {
  String name = file.getName();
  String path = file.getPath();
  String size = FileUtils.getFormattedSize(file);
  String lastModDate = FileUtils.getFormattedSize(file);
  TextView message = new TextView(mContext);
  TextView title = new TextView(mContext);
  message.setText(String.format
      (mContext.getResources().getString(R.string.file_info), name, path, size, lastModDate));
  message.setTextIsSelectable(true);
  title.setText(R.string.details);
  title.setPadding(20, 10, 10, 10);
  title.setTextSize(30);
  title.setTextColor(mContext.getResources().getColor(R.color.black));
  final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
  final AlertDialog dialog = builder.create();
  builder.setView(message);
  builder.setCustomTitle(title);
  builder.setPositiveButton(mContext.getResources().getString(R.string.ok),
      (dialogInterface, i) -> dialog.dismiss());
  builder.create();
  builder.show();
}

代码示例来源:origin: stackoverflow.com

TextView t1;

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  t1=(TextView) findViewById(R.id.textView1);
t1.setTextIsSelectable(true);// IMPORTANT
    t1.setText("This is Android program");
    t1.setOnTouchListener(new OnTouchListener() {

      @Override
      public boolean onTouch(View v, MotionEvent event) {
        switch(event.getAction()){
        case MotionEvent.ACTION_UP:
          int start=t1.getSelectionStart();
          int end=t1.getSelectionEnd();
          String sub=t1.getText().subSequence(start, end).toString();
          Toast.makeText(getBaseContext(), sub, 1).show();
        }
        return true;
      }
    });
}

代码示例来源:origin: morogoku/MTweaks-KernelAdiutorMOD

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
             @Nullable Bundle savedInstanceState) {
  View rootView = inflater.inflate(R.layout.fragment_description, container, false);
  mTitleView = rootView.findViewById(R.id.title);
  mSummaryView = 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;
}

代码示例来源:origin: pocmo/Yaaic

/**
 * Render message as text view
 *
 * @param context
 * @return
 */
public TextView renderTextView(Context context, TextView view)
{
  if (view == null) {
    view = new TextView(context);
  }
  view.setAutoLinkMask(Linkify.ALL);
  view.setLinksClickable(true);
  view.setLinkTextColor(COLOR_BLUE);
  view.setText(this.render(context));
  view.setTextIsSelectable(true);
  return view;
}

相关文章

TextView类方法