Android 更改AlertDialog中超链接的颜色
正常情况下,这种行为并不引人注目,但在三星Galaxy S上,默认的AlertDialog背景为蓝色,正常格式的链接(蓝色)消失。 不幸的是,下面的代码没有改变链接的颜色 有人有主意吗Android 更改AlertDialog中超链接的颜色,android,Android,正常情况下,这种行为并不引人注目,但在三星Galaxy S上,默认的AlertDialog背景为蓝色,正常格式的链接(蓝色)消失。 不幸的是,下面的代码没有改变链接的颜色 有人有主意吗 public void showClickableDialog(String title, String msg) { final SpannableString s = new SpannableString(msg); Linkify.addLinks(s, Linkify.ALL);
public void showClickableDialog(String title, String msg) {
final SpannableString s = new SpannableString(msg);
Linkify.addLinks(s, Linkify.ALL);
final AlertDialog d = new AlertDialog.Builder(mContext)
.setPositiveButton(android.R.string.ok, null).setIcon(
R.drawable.logo).setTitle(title).setMessage(s).create();
d.show();
// Make the textview clickable. Must be called after show()
TextView textView = ((TextView) d.findViewById(android.R.id.message));
// Next Line unfortunately does nothing
textView.setTextColor(Color.MAGENTA);
textView.setBackgroundColor(Color.BLACK);
textView.setMovementMethod(LinkMovementMethod.getInstance());
}
我的
style.xml中有以下内容,以便使链接变成橙色:
<item name="android:textColorLink">#FF9900</item>
textView.setLinkTextColor(Color.MAGENTA);