【问题标题】:ListView with selector isn't working in Froyo带有选择器的 ListView 在 Froyo 中不起作用
【发布时间】:2013-02-25 10:38:59
【问题描述】:

我有这个:

row_selector.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"       android:exitFadeDuration="@android:integer/config_mediumAnimTime">

<item android:drawable="@color/green" android:state_pressed="true"/>
<item android:drawable="@color/blue" android:state_selected="true"/>
<item android:drawable="@color/yellow" android:state_activated="true"/>

</selector>

album_item.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/row_selector"
android:orientation="horizontal"
android:padding="5dip" >

AlbumCursorAdapter.java

public class AlbumCursorAdapter extends CursorAdapter {
...
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    final View view = mInflater.inflate(R.layout.album_item, parent, false);
...
}

为什么可以在 android 4.0 中工作,而不能在 Froyo 中工作?

谢谢!!

【问题讨论】:

    标签: listview colors selector android-2.2-froyo


    【解决方案1】:

    android:state_activated 在 android 3.0 (API 11) JavaDoc987654321@中引入

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-24
      • 1970-01-01
      • 2012-07-04
      • 2015-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多