android.widget.TextView#setTextIsSelectable ( )源码实例Demo

下面列出了android.widget.TextView#setTextIsSelectable ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: PicKing   文件: AboutActivity.java
@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();
        }
    });
}
 
源代码2 项目: YCCustomText   文件: HyperTextView.java
/**
 * 生成文本输入框
 */
private TextView createTextView(String hint, int paddingTop) {
    TextView textView = new TextView(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    textView.setLayoutParams(layoutParams);
    textView.setTextSize(16);
    textView.setTextColor(Color.parseColor("#616161"));
    textView.setTextIsSelectable(true);
    textView.setBackground(null);
    textView.setTag(viewTagIndex++);
    textView.setPadding(editNormalPadding, paddingTop, editNormalPadding, paddingTop);
    textView.setHint(hint);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, rtTextSize);
    textView.setLineSpacing(rtTextLineSpace, 1.0f);
    textView.setTextColor(rtTextColor);
    return textView;
}
 
源代码3 项目: KernelAdiutor   文件: DescriptionFragment.java
@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;
}
 
源代码4 项目: CapturePacket   文件: ViewUtil.java
public static TextView getContentTextView(Context context){
    TextView textView = new TextView(context);
    int dp_5 = context.getResources().getDimensionPixelSize(R.dimen.dp_5);
    textView.setPadding(dp_5,0,dp_5,0);
    textView.setTextSize(13);
    textView.setTextColor(0xff323232);
    textView.setTextIsSelectable(true);
    textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    return textView;
}
 
源代码5 项目: RxTools-master   文件: RxDialogSure.java
private void initView() {
    View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_sure, null);
    mTvSure = (TextView) dialogView.findViewById(R.id.tv_sure);
    mTvTitle = (TextView) dialogView.findViewById(R.id.tv_title);
    mTvTitle.setTextIsSelectable(true);
    mTvContent = (TextView) dialogView.findViewById(R.id.tv_content);
    mTvContent.setMovementMethod(ScrollingMovementMethod.getInstance());
    mTvContent.setTextIsSelectable(true);
    mIvLogo = (ImageView) dialogView.findViewById(R.id.iv_logo);
    setContentView(dialogView);
}
 
源代码6 项目: RxTools-master   文件: RxDialogSureCancel.java
private void initView() {
    View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_sure_false, null);
    mIvLogo = (ImageView) dialogView.findViewById(R.id.iv_logo);
    mTvSure = (TextView) dialogView.findViewById(R.id.tv_sure);
    mTvCancel = (TextView) dialogView.findViewById(R.id.tv_cancel);
    mTvContent = (TextView) dialogView.findViewById(R.id.tv_content);
    mTvContent.setTextIsSelectable(true);
    mTvTitle = (TextView) dialogView.findViewById(R.id.tv_title);
    setContentView(dialogView);
}
 
源代码7 项目: WiFiKeyShare   文件: WifiListActivity.java
@Override
public boolean onContextItemSelected(MenuItem item) {
    int itemPosition = ((ContextMenuRecyclerView.RecyclerContextMenuInfo) item.getMenuInfo()).position;
    switch (item.getItemId()) {
        case (R.id.context_menu_wifi_list_view_password):
            final AlertDialog viewPasswordDialog = new AlertDialog.Builder(this)
                    .setTitle(getString(R.string.wifilist_dialog_view_password))
                    .setView(R.layout.dialog_view_password)
                    .setPositiveButton(R.string.action_close, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            dialogInterface.dismiss();
                        }
                    })
                    .create();
            viewPasswordDialog.show();

            /* Set SSID, security and password values */
            TextView ssidTextView = (TextView) viewPasswordDialog.findViewById(R.id.ssid_value);
            TextView authTypeTextView = (TextView) viewPasswordDialog.findViewById(R.id.auth_type_value);
            TextView passwordTextView = (TextView) viewPasswordDialog.findViewById(R.id.password_value);
            ssidTextView.setText(wifiNetworks.get(itemPosition).getSsid());
            authTypeTextView.setText(wifiNetworks.get(itemPosition).getAuthType().toString());
            passwordTextView.setText(wifiNetworks.get(itemPosition).getKey());
            passwordTextView.setTextIsSelectable(true);
            return true;
        case (R.id.context_menu_wifi_list_clear_password):
            removeSavedWifiKey(itemPosition);
            return true;
    }

    return super.onContextItemSelected(item);
}
 
源代码8 项目: WiFiKeyShare   文件: WifiNetworkActivity.java
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_view_password:
            // FIXME: redundant with @WifiListActivity#onContextItemSelected
            final AlertDialog viewPasswordDialog = new AlertDialog.Builder(this)
                    .setTitle(getString(R.string.wifi_dialog_view_password))
                    .setView(R.layout.dialog_view_password)
                    .setPositiveButton(R.string.action_close, new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialogInterface, int i) {
                            dialogInterface.dismiss();
                        }
                    })
                    .create();
            viewPasswordDialog.show();

            /* Set SSID, security and password values */
            TextView ssidTextView = (TextView) viewPasswordDialog.findViewById(R.id.ssid_value);
            TextView authTypeTextView = (TextView) viewPasswordDialog.findViewById(R.id.auth_type_value);
            TextView passwordTextView = (TextView) viewPasswordDialog.findViewById(R.id.password_value);
            ssidTextView.setText(wifiNetwork.getSsid());
            authTypeTextView.setText(wifiNetwork.getAuthType().toString());
            passwordTextView.setText(wifiNetwork.getKey());
            passwordTextView.setTextIsSelectable(true);
            return true;
        case R.id.action_settings:
            startActivity(new Intent(this, SettingsActivity.class));
            return true;
        case R.id.action_about:
            final AlertDialog aboutDialog = new AboutDialog(this);
            aboutDialog.show();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
源代码9 项目: tindroid   文件: AccountInfoFragment.java
@Override
public void updateFormValues(final AppCompatActivity activity, final MeTopic<VxCard> me) {
    if (activity == null) {
        return;
    }

    ((TextView) activity.findViewById(R.id.topicAddress)).setText(Cache.getTinode().getMyId());

    String fn = null;
    if (me != null) {
        VxCard pub = me.getPub();
        if (pub != null) {
            fn = pub.fn;
            final Bitmap bmp = pub.getBitmap();
            if (bmp != null) {
                ((AppCompatImageView) activity.findViewById(R.id.imageAvatar))
                        .setImageDrawable(new RoundImageDrawable(getResources(), bmp));
            }
        }
    }

    final TextView title = activity.findViewById(R.id.topicTitle);
    if (!TextUtils.isEmpty(fn)) {
        title.setText(fn);
        title.setTypeface(null, Typeface.NORMAL);
        title.setTextIsSelectable(true);
    } else {
        title.setText(R.string.placeholder_contact_title);
        title.setTypeface(null, Typeface.ITALIC);
        title.setTextIsSelectable(false);
    }
}
 
源代码10 项目: Android-Shortify   文件: Views.java
public static $ selectable(){
    try{
        if(mView instanceof TextView){
            TextView textView = (TextView) mView;
            textView.setTextIsSelectable(true);
        }
    }catch (Exception e){
        Log.d(TAG, e.getMessage());
    }
    return  $.getInstance();
}
 
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final TextView resultView = new TextView(getActivity());
    final int paddingDp = 10;
    final int paddingPx = dpToPx(paddingDp);
    resultView.setPadding(paddingPx, paddingPx, paddingPx, paddingPx);
    resultView.setText(Html.fromHtml(getArguments().getString(MESSAGE)));
    resultView.setTextIsSelectable(true);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    return builder.setTitle(getArguments().getInt(TITLE_RES_ID))
            .setView(resultView)
            .create();
}
 
源代码12 项目: MaterialQQLite   文件: ChatMsgAdapter.java
private void setBubble(TextView txtContent, ChatMsg chatMsg) {		
	Integer nOldBubble = (Integer)txtContent.getTag();
	if (null == nOldBubble || nOldBubble != chatMsg.m_nBubble) {
		int left = txtContent.getPaddingLeft();
        int right = txtContent.getPaddingRight();
        int top = txtContent.getPaddingTop();
        int bottom = txtContent.getPaddingBottom();

        boolean bIsUser = (ChatMsg.RIGHT == chatMsg.m_nType);
		boolean bUseDefBubble = true;
		
		if (chatMsg.m_nBubble != 0) {				
			//
		}
		
		if (bUseDefBubble) {
			if (bIsUser) {
				txtContent.setBackgroundResource(R.drawable.btn_style7);
				txtContent.setTextColor(0xFFFFFFFF);
                   txtContent.setTextIsSelectable(true);
				txtContent.setLinkTextColor(0xFF0000FF);
			} else {
				txtContent.setBackgroundResource(R.drawable.btn_style6);
				txtContent.setTextColor(0xFF000000);
                   txtContent.setTextIsSelectable(true);
				txtContent.setLinkTextColor(0xFF0000FF);
			}
			txtContent.setTag(0);
		}
		
		txtContent.setPadding(left, top, right, bottom);
	}
}
 
源代码13 项目: RedReader   文件: PropertiesDialog.java
protected final LinearLayout propView(final Context context, final String title, final CharSequence text, final boolean firstInList) {

		final int paddingPixels = General.dpToPixels(context, 12);

		final LinearLayout prop = new LinearLayout(context);
		prop.setOrientation(LinearLayout.VERTICAL);

		if(!firstInList) {
			final View divider = new View(context);
			divider.setMinimumHeight(General.dpToPixels(context, 1));
			divider.setBackgroundColor(rrListDividerCol);
			prop.addView(divider);
		}

		final TextView titleView = new TextView(context);
		titleView.setText(title.toUpperCase(Locale.getDefault()));
		titleView.setTextColor(rrListHeaderTextCol);
		titleView.setTextSize(12.0f);
		titleView.setPadding(paddingPixels, paddingPixels, paddingPixels, 0);
		prop.addView(titleView);

		final TextView textView = new TextView(context);
		textView.setText(text);
		textView.setTextColor(rrCommentBodyCol);
		textView.setTextSize(15.0f);
		textView.setPadding(paddingPixels, 0, paddingPixels, paddingPixels);
		textView.setTextIsSelectable(true);
		prop.addView(textView);

		return prop;
	}
 
源代码14 项目: EdXposedManager   文件: DownloadDetailsFragment.java
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final Module module = mActivity.getModule();
    if (module == null)
        return null;

    final View view = inflater.inflate(R.layout.download_details, container, false);

    TextView title = view.findViewById(R.id.download_title);
    title.setText(module.name);
    title.setTextIsSelectable(true);

    TextView author = view.findViewById(R.id.download_author);
    if (module.author != null && !module.author.isEmpty())
        author.setText(getString(R.string.download_author, module.author));
    else
        author.setText(R.string.download_unknown_author);

    TextView description = view.findViewById(R.id.download_description);
    if (module.description != null) {
        if (module.descriptionIsHtml) {
            description.setText(RepoParser.parseSimpleHtml(getActivity(), module.description, description));
            description.setTransformationMethod(new LinkTransformationMethod(getActivity()));
            description.setMovementMethod(LinkMovementMethod.getInstance());
        } else {
            description.setText(module.description);
        }
        description.setTextIsSelectable(true);
    } else {
        description.setVisibility(View.GONE);
    }

    ViewGroup moreInfoContainer = view.findViewById(R.id.download_moreinfo_container);
    for (Pair<String, String> moreInfoEntry : module.moreInfo) {
        View moreInfoView = inflater.inflate(R.layout.download_moreinfo, moreInfoContainer, false);
        TextView txtTitle = moreInfoView.findViewById(android.R.id.title);
        TextView txtValue = moreInfoView.findViewById(android.R.id.message);

        txtTitle.setText(String.format(moreInfoEntry.first + "%s", ":"));
        txtValue.setText(moreInfoEntry.second);

        final Uri link = NavUtil.parseURL(moreInfoEntry.second);
        if (link != null) {
            txtValue.setTextColor(txtValue.getLinkTextColors());
            moreInfoView.setOnClickListener(v -> NavUtil.startURL(getActivity(), link));
        }

        moreInfoContainer.addView(moreInfoView);
    }

    return view;
}
 
源代码15 项目: allenglish   文件: CommonUtils.java
public static void setTextView(TextView tv, CharSequence charSequence) {
    tv.setMovementMethod(new ScrollingMovementMethod()); // 设置TextView可滚动
    tv.setTextIsSelectable(true); // 设置文本可选
    tv.setText(charSequence);
}
 
源代码16 项目: tindroid   文件: TopicInfoFragment.java
private void notifyContentChanged() {

        final Activity activity = getActivity();
        if (activity == null || activity.isFinishing() || activity.isDestroyed()) {
            return;
        }

        final AppCompatImageView avatar = activity.findViewById(R.id.imageAvatar);
        final TextView title = activity.findViewById(R.id.topicTitle);
        final TextView subtitle = activity.findViewById(R.id.topicSubtitle);

        VxCard pub = mTopic.getPub();
        if (pub != null && !TextUtils.isEmpty(pub.fn)) {
            title.setText(pub.fn);
            title.setTypeface(null, Typeface.NORMAL);
            title.setTextIsSelectable(true);
        } else {
            title.setText(R.string.placeholder_contact_title);
            title.setTypeface(null, Typeface.ITALIC);
            title.setTextIsSelectable(false);
        }

        final Bitmap bmp = pub != null ? pub.getBitmap() : null;
        if (bmp != null) {
            avatar.setImageDrawable(new RoundImageDrawable(getResources(), bmp));
        } else {
            avatar.setImageDrawable(
                    new LetterTileDrawable(requireContext())
                            .setIsCircular(true)
                            .setContactTypeAndColor(
                                    mTopic.getTopicType() == Topic.TopicType.P2P ?
                                            LetterTileDrawable.ContactType.PERSON :
                                            LetterTileDrawable.ContactType.GROUP)
                            .setLetterAndColor(pub != null ? pub.fn : null, mTopic.getName()));
        }

        PrivateType priv = mTopic.getPriv();
        if (priv != null && !TextUtils.isEmpty(priv.getComment())) {
            subtitle.setText(priv.getComment());
            subtitle.setTypeface(null, Typeface.NORMAL);
            TypedValue typedValue = new TypedValue();
            Resources.Theme theme = getActivity().getTheme();
            theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
            TypedArray arr = activity.obtainStyledAttributes(typedValue.data,
                    new int[]{android.R.attr.textColorSecondary});
            subtitle.setTextColor(arr.getColor(0, -1));
            arr.recycle();
            subtitle.setTextIsSelectable(true);
        } else {
            subtitle.setText(R.string.placeholder_private);
            subtitle.setTypeface(null, Typeface.ITALIC);
            subtitle.setTextColor(getResources().getColor(R.color.colorTextPlaceholder));
            subtitle.setTextIsSelectable(false);
        }

        ((Switch) activity.findViewById(R.id.switchMuted)).setChecked(mTopic.isMuted());
        ((Switch) activity.findViewById(R.id.switchArchived)).setChecked(mTopic.isArchived());

        Acs acs = mTopic.getAccessMode();
        ((TextView) activity.findViewById(R.id.permissionsSingle)).setText(acs == null ? "" : acs.getMode());
    }
 
源代码17 项目: Overchan-Android   文件: CompatibilityImpl.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void setTextIsSelectable(TextView textView) {
    textView.setTextIsSelectable(true);
}
 
源代码18 项目: Rumble   文件: DisplayStatusActivity.java
private void renderStatus(String statusID) {

        PushStatus status = DatabaseFactory.getPushStatusDatabase(this).getStatus(statusID);
        if(status == null)
            return;

        ImageView avatarView    = (ImageView)findViewById(R.id.status_item_avatar);
        TextView authorView     = (TextView) findViewById(R.id.status_item_author);
        TextView textView       = (TextView) findViewById(R.id.status_item_body);
        TextView tocView        = (TextView) findViewById(R.id.status_item_created);
        TextView toaView        = (TextView) findViewById(R.id.status_item_received);
        TextView groupNameView  = (TextView) findViewById(R.id.status_item_group_name);
        ImageView attachedView  = (ImageView)findViewById(R.id.status_item_attached_image);
        ImageView moreView      = (ImageView)findViewById(R.id.status_item_more_options);
        LinearLayout box        = (LinearLayout)findViewById(R.id.status_item_box);

        final String uid = status.getAuthor().getUid();
        final String name= status.getAuthor().getName();

        // we draw the avatar
        ColorGenerator generator = ColorGenerator.DEFAULT;
        avatarView.setImageDrawable(
                builder.build(status.getAuthor().getName().substring(0, 1),
                        generator.getColor(status.getAuthor().getUid())));

        // we draw the author field
        authorView.setText(status.getAuthor().getName());
        tocView.setText(TimeUtil.timeElapsed(status.getTimeOfCreation()));
        toaView.setText(TimeUtil.timeElapsed(status.getTimeOfArrival()));
        groupNameView.setText(status.getGroup().getName());
        groupNameView.setTextColor(generator.getColor(status.getGroup().getGid()));

        // we draw the status (with clickable links)
        textView.setText(status.getPost());
        textView.setMovementMethod(LinkMovementMethod.getInstance());
        textView.setTextIsSelectable(true);

        Linkify.addLinks(textView, Linkify.ALL);

        /* todo: clickable hashtags */

        /* we draw the attached file (if any) */
        if (status.hasAttachedFile()) {
            attachedView.setVisibility(View.VISIBLE);
            try {
                final File attachedFile = new File(FileUtil.getReadableAlbumStorageDir(), status.getFileName());

                if (!attachedFile.isFile() || !attachedFile.exists())
                    throw new IOException("file does not exists");

                Picasso.with(DisplayStatusActivity.this)
                        .load("file://"+attachedFile.getAbsolutePath())
                        .resize(96, 96)
                        .centerCrop()
                        .into(attachedView);

                final String filename =  status.getFileName();

		/* we open the attached image file in gallery */
                attachedView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Log.d(TAG, "trying to open: " + filename);
			Intent intent = new Intent();
			intent.setAction(Intent.ACTION_VIEW);
			intent.setDataAndType(Uri.parse("file://"+attachedFile.getAbsolutePath()), "image/*");
			startActivity(intent);

                    }
                });
            } catch (IOException ignore) {
                Picasso.with(DisplayStatusActivity.this)
                        .load(R.drawable.ic_close_black_48dp)
                        .resize(96, 96)
                        .centerCrop()
                        .into(attachedView);
            }
        } else {
            attachedView.setVisibility(View.GONE);
        }
        /*
        moreView.setOnClickListener(new PopupMenuListener());
        if (!status.hasUserReadAlready() || ((System.currentTimeMillis() - status.getTimeOfArrival()) < 60000)) {
            if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
                box.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.status_shape_unread));
            } else {
                box.setBackground(activity.getResources().getDrawable(R.drawable.status_shape_unread));
            }
            if (!status.hasUserReadAlready()) {
                status.setUserRead(true);
                EventBus.getDefault().post(new UserReadStatus(status));
            }
        } else {
            if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
                box.setBackgroundDrawable(activity.getResources().getDrawable(R.drawable.status_shape_read));
            } else {
                box.setBackground(activity.getResources().getDrawable(R.drawable.status_shape_read));
            }
        }
        */
    }
 
源代码19 项目: QuickLyric   文件: LyricsTextFactory.java
@SuppressLint("newAPI")
public void setSelectable(TextView t) {
    t.setTextIsSelectable(true);
}
 
 方法所在类
 同类方法