本文整理汇总了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;
}
示例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();
}
});
}
示例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());
}
}
示例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);
}
}
}
示例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);
}