Android 默认的ListView 控件是不支持更改字体颜色,或是字体Style
如果想实现这个功能,需要自己编写一些代码
步骤1:
定义一个ListView item的资源xml,将其放入res/layout/ 目录下,比如list_item1.xml,内容为:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/White"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:minHeight="?android:attr/listPreferredItemHeight"
>
</TextView>
步骤2:
改一下程序:
final ArrayList<String> array = new ArrayList<String>();
final ArrayAdapter<String> aa;
aa = new ArrayAdapter<String>(ShowBlues.this, R.layout.list_item1,array);
目标:选中item,其
字体
设置为#3197FF,未选中的,其
字体
为#FFFFFF。其效果图如下:
与listvew设置选中行item背景图片一样,使用selector,不过这里的
颜色
设置,应该是在
listview
中的textview中设置。
<TableLayout
xmlns:
android
="http://schemas.
android
.com/apk/res/andr
对于能够显示
文字
的控件(如TextView EditText RadioButton Button CheckBox Chronometer等等),你有时需要控制
字体
的大小。
Android
平台定义了三种
字体
大小。java代码:
"?
android
:attr/textAppearanceLarge"
"?
android
:attr/textAppearanceMediu...
Ubuntu启用root账户后,登录root账户时报错:读取/root/.profile时发现错误:mesg:ttyname failed:对设备不适当的ioctl操作 作为结果,会话不会被正确配置
Ubuntu从字符界面打开图形界面,别用startx
风过林梢–:
试图搞懂MDK程序下载到flash(三)--MDK配置选项Linker、Target、Debug的理解分析
qq_42855365: