开发者

How do you change the textcolor of the list items in an AlertDialog

开发者 https://www.devze.com 2023-01-28 12:02 出处:网络
Hello I am trying to change the text color of the items in a list on a ListPreference pop up window.I have spent over an hour looking through all of the various style names but I can\'t f开发者_JAVA百

Hello I am trying to change the text color of the items in a list on a ListPreference pop up window. I have spent over an hour looking through all of the various style names but I can't f开发者_JAVA百科ind TextAppearance or anything that goes to this particular text. Thanks for your help!


You can't and you shouldn't. *Preference uses styles from com.android.internal.R.styleable which might be changed by manufactures. The idea of using the default ones is that every preference screen in your device look alike.

On the other hand you can try doing an Activity with android:theme="@android:style/Theme.Dialog" in your app's AndroidManifest and place a ListView styled as you want.


I don't really know which kind of View use ListPreference, probably it's something like TextView. If so than you could make smth like:

TextView textView;
String myString;
//....
SpannableString spanString=new SpannableString(myString);
spanString.setSpan(new ForegroundColorSpan(Color.RED), 0, myString.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
textView.setText(spanString);
0

精彩评论

暂无评论...
验证码 换一张
取 消