Android的选择和放大器;文字颜色 [英] Android selector & text color

查看:102
本文介绍了Android的选择和放大器;文字颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个简单的的TextView 的行为 simple_list_item_1管理 ListView控件的方式一样。这里的XML:

I want a simple TextView to behave the way simple_list_item_1 in a ListView does. Here's the XML:

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content" android:layout_width="fill_parent"
    android:gravity="center" android:focusable="true"
    android:minHeight="?android:attr/listPreferredItemHeight"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:background="@android:drawable/list_selector_background" />

一切正常,除了文本颜色(果然)不在聚焦状态更改。我如何将其更改为 textAppearanceLargeInverse

推荐答案

和选择是这里的答案也是如此。

And selector is the answer here as well.

搜索bright_text_dark_focused.xml的来源,添加到您的项目在RES /彩色目录,然后从TextView的引用为

Search for bright_text_dark_focused.xml in the sources, add to your project under res/color directory and then refer from the TextView as

android:textColor="@color/bright_text_dark_focused"

这篇关于Android的选择和放大器;文字颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆