Example usage for android.widget TextView setTextIsSelectable

List of usage examples for android.widget TextView setTextIsSelectable

Introduction

In this page you can find the example usage for android.widget TextView setTextIsSelectable.

Prototype

public void setTextIsSelectable(boolean selectable) 

Source Link

Document

Sets whether the content of this view is selectable by the user.

Usage

From source file:ca.zadrox.dota2esportticker.ui.MatchDetailActivity.java

private void setTextSelectable(TextView tv) {
    if (tv != null && !tv.isTextSelectable()) {
        tv.setTextIsSelectable(true);
    }
}

From source file:be.brunoparmentier.wifikeyshare.ui.activities.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//from   ww w .  ja v a 2  s  . co m
                    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);
    }
}

From source file:com.near.chimerarevo.fragments.PostFragment.java

private void addTitle(String text, int type) {
    TextView txt = new TextView(getActivity());
    txt.setText(text);//w  ww .  j  av a2 s .  c  o  m
    txt.setTypeface(Typeface.create("sans-serif-condensed", Typeface.BOLD));
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    params.setMargins(10, 10, 10, 0);
    txt.setLayoutParams(params);
    txt.setTextIsSelectable(true);

    switch (type) {
    case 1:
        txt.setTextSize(26);
        break;
    case 2:
        txt.setTextSize(24);
        break;
    case 3:
        txt.setTextSize(22);
        break;
    case 4:
        txt.setTextSize(20);
        break;
    case 5:
        txt.setTextSize(18);
        break;
    default:
        break;
    }

    lay.addView(txt);
}

From source file:com.adamkruger.myipaddressinfo.NetworkInfoFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private TextView makeTextView(String value, int color, int horizontalPadding) {
    Context context = getActivity();
    TextView textView = new TextView(context);
    textView.setText(value);//  w  ww.  j  av  a2s . com
    textView.setLayoutParams(
            new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
    textView.setTextAppearance(context, android.R.attr.textAppearanceSmall);
    textView.setTextColor(color);
    textView.setPadding(horizontalPadding, 0, horizontalPadding, 0);
    textView.setSingleLine(false);
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        textView.setTextIsSelectable(true);
    }
    return textView;
}

From source file:net.inbox.InboxMessage.java

/**
 * Dialog showing the IP of the message sender.
 **//*from w ww . ja  va2 s. c  om*/
private void dialog_originating() {
    TextView tv_msg = new TextView(this);
    tv_msg.setTextIsSelectable(true);
    tv_msg.setPadding(20, 20, 20, 0);
    tv_msg.setText(current.get_received());
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(R.string.message_dialog));
    builder.setView(tv_msg);
    builder.setPositiveButton(getString(android.R.string.ok), null);
    builder.show();
}