android:listSelector="#FFFFFF" //你想要什么颜色,就填什么颜色,
只要焦点没有移动到点击的位置,你松手之后Item的颜色又会变成最初的颜色
至于跳转到别的Activity只需要在程序中获得ListView控件的对象,在其 listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?>arg0, View arg1, int arg2,
long arg3) {
Intent intent=new Intent(Test01.this,Test02.class)
Test01.this.startActivity(intent)
})
这样就能进行跳转了
设置方法如下:
String str = "美女们我爱你"String str1 = "美女们"
if (!TextUtils.isEmpty(str)) {
SpannableStringBuilder builder = new SpannableStringBuilder(str)
// ForegroundColorSpan 为文字前景色,BackgroundColorSpan为文字背景色
ForegroundColorSpan redSpan = new ForegroundColorSpan(Color.Red)
ForegroundColorSpan blackSpan = new ForegroundColorSpan(Color.Black)
builder.setSpan(redSpan, 0, str1.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
builder.setSpan(blackSpan, str1.length(), str.length(),
Spannable.SPAN_INCLUSIVE_INCLUSIVE)
TV.setText(builder)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)