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

标题: [解決] Android如何修改List Highlighter的颜色?Custom Adpater [打印本页]

作者: 资讯王    时间: 2014-2-23 03:07
标题: [解決] Android如何修改List Highlighter的颜色?Custom Adpater
[解決] 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">
复制代码





欢迎光临 大马资讯论坛 - 马来西亚中文资讯平台 (http://www.freeinfo.com.my/) Powered by Discuz! X3.3