List of usage examples for android.widget TextView setTextIsSelectable
public void setTextIsSelectable(boolean selectable)
From source file:cn.foxnickel.listentome.view.ViewUtil.java
public static View getWordsView(Context context, String word, @ColorRes int color, boolean isTextSelectable) { TextView tv = new TextView(context); tv.setTextColor(ContextCompat.getColor(context, color)); tv.setPadding(0, 6, 0, 6);/*from w ww .j a v a 2 s . c o m*/ tv.setTextSize(16); tv.setTextIsSelectable(isTextSelectable); tv.setGravity(Gravity.LEFT); tv.setText(word); return tv; }
From source file:com.mods.grx.settings.utils.Utils.java
public static void animate_textview_marquee(TextView textView) { textView.setTextIsSelectable(true); textView.setSingleLine(true);// ww w . j a v a 2 s .co m textView.setHorizontallyScrolling(true); textView.setEllipsize(TextUtils.TruncateAt.MARQUEE); textView.setMarqueeRepeatLimit(1); }
From source file:com.mods.grx.settings.utils.Utils.java
public static void animate_textview_marquee_forever(TextView textView) { textView.setTextIsSelectable(true); textView.setSingleLine(true);/* w w w .j ava 2 s .c o m*/ textView.setHorizontallyScrolling(true); textView.setEllipsize(TextUtils.TruncateAt.MARQUEE); }
From source file:org.mariotaku.twidere.preference.ThemePreviewPreference.java
private static void setPreviewView(final Context context, final View view, final int themeRes) { if (view instanceof IExtendedView) { ((IExtendedView) view).setTouchInterceptor(new DummyTouchInterceptor()); }/* w w w. ja v a 2s.c o m*/ final View windowBackgroundView = view.findViewById(R.id.theme_preview_window_background); final View windowContentOverlayView = view.findViewById(R.id.theme_preview_window_content_overlay); final View actionBarOverlay = view.findViewById(R.id.actionbar_overlay); final Toolbar actionBarView = (Toolbar) view.findViewById(R.id.action_bar); final ActionMenuView menuBar = (ActionMenuView) view.findViewById(R.id.menu_bar); final View statusContentView = view.findViewById(R.id.theme_preview_status_content); final CardView cardView = (CardView) view.findViewById(R.id.card); final int defaultTextSize = getDefaultTextSize(context); final int cardBackgroundColor = ThemeUtils.getCardBackgroundColor(context, ThemeUtils.getThemeBackgroundOption(context), ThemeUtils.getUserThemeBackgroundAlpha(context)); final int accentColor = ThemeUtils.getUserAccentColor(context); final int themeId = ThemeUtils.getNoActionBarThemeResource(context); final String backgroundOption = ThemeUtils.getThemeBackgroundOption(context); ThemeUtils.applyWindowBackground(context, windowBackgroundView, themeId, backgroundOption, ThemeUtils.getUserThemeBackgroundAlpha(context)); ViewSupport.setBackground(actionBarView, ThemeUtils.getActionBarBackground(context, themeRes, accentColor, backgroundOption, true)); ViewCompat.setElevation(actionBarView, ThemeUtils.getSupportActionBarElevation(context)); ViewSupport.setBackground(actionBarOverlay, ThemeUtils.getWindowContentOverlay(context)); cardView.setCardBackgroundColor(cardBackgroundColor); actionBarView.setTitle(R.string.app_name); menuBar.setEnabled(false); final MenuInflater inflater = new SupportMenuInflater(context); inflater.inflate(R.menu.menu_status, menuBar.getMenu()); ThemeUtils.wrapMenuIcon(menuBar, MENU_GROUP_STATUS_SHARE); if (statusContentView != null) { final View profileView = statusContentView.findViewById(R.id.profile_container); final ImageView profileImageView = (ImageView) statusContentView.findViewById(R.id.profile_image); final TextView nameView = (TextView) statusContentView.findViewById(R.id.name); final TextView screenNameView = (TextView) statusContentView.findViewById(R.id.screen_name); final TextView textView = (TextView) statusContentView.findViewById(R.id.text); final TextView timeSourceView = (TextView) statusContentView.findViewById(R.id.time_source); final View retweetedByContainer = statusContentView.findViewById(R.id.retweeted_by_container); retweetedByContainer.setVisibility(View.GONE); nameView.setTextSize(defaultTextSize * 1.25f); textView.setTextSize(defaultTextSize * 1.25f); screenNameView.setTextSize(defaultTextSize * 0.85f); timeSourceView.setTextSize(defaultTextSize * 0.85f); profileView.setBackgroundResource(0); textView.setTextIsSelectable(false); profileImageView.setImageResource(R.mipmap.ic_launcher); nameView.setText(TWIDERE_PREVIEW_NAME); screenNameView.setText("@" + TWIDERE_PREVIEW_SCREEN_NAME); textView.setText(toPlainText(TWIDERE_PREVIEW_TEXT_HTML)); final String time = formatToLongTimeString(context, System.currentTimeMillis()); timeSourceView .setText(toPlainText(context.getString(R.string.time_source, time, TWIDERE_PREVIEW_SOURCE))); } }
From source file:com.publisnet.leydeinfogobierno.ArticuloActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void text(TextView as) { as.setTextIsSelectable(true); }
From source file:de.marcelkapfer.morseconverter.DisplayMessageActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the message from the intent Intent intent = getIntent();/* w w w . ja v a 2s . c o m*/ String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Create the text view TextView textView = new TextView(this); textView.setTextSize(20); textView.setText(message); textView.setTextIsSelectable(true); textView.setPadding(10, 10, 10, 10); // Set the text view as the activity layout setContentView(textView); }
From source file:com.github.reline.jisho.ui.recyclerview.WordViewHolder.java
private void bindPartsOfSpeech(List<String> pos) { if (pos.isEmpty()) return;//from ww w . ja v a2 s .c o m TextView posTextView = new TextView(itemView.getContext()); StringBuilder partsOfSpeech = new StringBuilder(); for (int i = 0; i < pos.size(); i++) { partsOfSpeech.append(pos.get(i)).append(i < pos.size() - 1 ? ", " : ""); } posTextView.setText(partsOfSpeech.toString()); posTextView.setTextColor(ContextCompat.getColor(itemView.getContext(), R.color.colorAccent)); posTextView.setTextIsSelectable(true); sensesLayout.addView(posTextView); }
From source file:com.github.reline.jisho.ui.recyclerview.WordViewHolder.java
private void bindSenses(List<Sense> senses) { sensesLayout.removeAllViews();//from w ww . j a v a 2 s . co m for (int i = 0; i < senses.size(); i++) { Sense sense = senses.get(i); bindPartsOfSpeech(sense.getPartsOfSpeech()); TextView definitionTextView = new TextView(itemView.getContext()); String definition = String.valueOf(i + 1) + ". "; List<String> englishDefinitions = sense.getEnglishDefinitions(); for (int k = 0; k < englishDefinitions.size(); k++) { definition += englishDefinitions.get(k) + (k < englishDefinitions.size() - 1 ? "; " : ""); } definitionTextView.setText(definition); definitionTextView.setTextIsSelectable(true); sensesLayout.addView(definitionTextView); } }
From source file:com.grokkingandroid.sampleapp.samples.SampleBaseFragment.java
@SuppressLint("NewApi") protected void showLinks(ViewGroup container) { String[] linkTexts = getLinkTexts(); String[] linkTargets = getLinkTargets(); StringBuilder link = null;/* w ww . j ava 2s. c o m*/ for (int i = 0; i < linkTexts.length; i++) { // TODO: Use an inflater TextView tv = new TextView(getActivity()); LinearLayout.LayoutParams params = null; params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); if (i != linkTexts.length - 1) { int marginBottom = getResources().getDimensionPixelSize(R.dimen.linkSpacing); params.setMargins(0, 0, 0, marginBottom); } tv.setLayoutParams(params); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { tv.setTextIsSelectable(true); } tv.setTextAppearance(getActivity(), android.R.style.TextAppearance_Medium); link = new StringBuilder(100); link.append("<a href=\""); link.append(linkTargets[i]); link.append("\">"); link.append(linkTexts[i]); link.append("</a>"); Spanned spannedLink = Html.fromHtml(link.toString()); tv.setText(spannedLink); tv.setMovementMethod(LinkMovementMethod.getInstance()); container.addView(tv); } }
From source file:com.android.mms.rcs.FavoriteDetailAdapter.java
private void initTextMsgView(final TextView bodyText) { bodyText.setText(/*from w ww . j a v a 2s . c o m*/ mCursor.getString(mCursor.getColumnIndexOrThrow(FavoriteMessageProvider.FavoriteMessage.CONTENT))); bodyText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mBodyFontSize); bodyText.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); bodyText.setTextIsSelectable(true); bodyText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { MessageUtils.onMessageContentClick(mContext, bodyText); } }); }