大马资讯论坛 - 马来西亚中文资讯平台

 找回密码
 注册
搜索
打印 上一主题 下一主题

[解決] Android如何修改List Highlighter的颜色?Custom Adpater

[复制链接]
跳转到指定楼层
1#
发表于 2014-2-23 03:07:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
[解決] Android如何修改List Highlighter的颜色?Custom Adpater

1. 在res开一个folder叫drawable,在里面create一个xml的档案叫rounded_shape,把以下代码copy进去
  1. <selector xmlns:android="http://schemas.android.com/apk/res/android">

  2.    <item android:state_pressed="true">
  3.        <shape  >
  4.          <solid android:color="#929292" />
  5.        </shape>
  6.    </item>

  7.    <item>
  8.      <shape  >
  9.         <solid android:color="#FFFFFF" />
  10.      </shape>
  11.    </item>

  12. </selector>
复制代码
2. 到你的layout foulder找出你的xml,set android:background="@drawable/rounded_shape"
  1. <RelativeLayout
  2. android:layout_width="match_parent"
  3. android:layout_height="wrap_content"
  4. android:background="@drawable/rounded_shape">
复制代码

手机版|大马资讯论坛  

GMT+8, 2024-4-29 05:58 , Processed in 0.020194 second(s), 11 queries , File On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表