내 문제 : ListViews 항목을 클릭하면 '상태가 순서대로 변경됩니다. 선택하지 않은 경우 - 체크되지 않음, 체크되지 않음, 체크되지 않음, 체크 됨. 확인하지 않는 경우android ListView 항목 반짝 반짝 빛나는 버그 클릭
을 winkling : 검사 - 검사되지 않은 (문제)
이 버그는 만 미리 벌집 장치에 나타납니다, ICS에 모든 것이 좋아입니다
나는이 버그가 참조 생각 내장 안드로이드의 메커니즘. 그렇다면 해결책이 있습니까?
내가 무엇을 가지고 :
1) 목록보기 (multiChoice = true
)
2) 선택기 :의 ListView '항목 레이아웃에 적용
<item android:drawable="@color/main_listview_item_pressed_longpressed"
android:state_pressed="true" />
<item android:drawable="@color/main_listview_item_pressed_longpressed"
android:state_checked="true" />
3) 항목 레이아웃 :
<com.sasha.medclock2.CheckedLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingLeft="5dip"
android:background="@drawable/list_item_selector"
android:id="@+id/linerar_layout_checkable"
>
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@drawable/textview_selector"
/>
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@drawable/textview_selector"
/>
<TextView
android:id="@+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@drawable/textview_selector"
/>
<TextView
android:id="@+id/text4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@drawable/textview_selector"
/>
</com.sasha.medclock2.CheckedLinearLayout>
4) CheckedLinearLayout :
public class CheckedLinearLayout extends LinearLayout implements Checkable {
private final static String TAG = "CheckableLinearLayout";
private static final int[] CHECKED_STATE_SET = {
android.R.attr.state_checked
};
private boolean checked = false;
public CheckedLinearLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CheckedLinearLayout(Context context) {
super(context);
}
@Override
public boolean isChecked() {
return checked;
}
@Override
public void setChecked(boolean checked) {
this.checked = checked;
refreshDrawableState();
//Propagate to childs
final int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if(child instanceof Checkable) {
((Checkable)child).setChecked(checked);
}
}
}
@Override
protected int[] onCreateDrawableState(int extraSpace) {
final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
if (isChecked()) {
mergeDrawableStates(drawableState, CHECKED_STATE_SET);
}
return drawableState;
}
@Override
public void toggle() {
this.checked = !this.checked;
}
}
5) 나는 ActionBarSherlock
LIB뿐만 아니라 내가 ListView.setItemChecked (와의 ListView '항목을 확인 HoloEverywhere
6) ...)
등을 사용하고 있습니다많은 도움을 주셔서 감사합니다.
이미이 방법을 시도했습니다. 문제는 더욱 깊어졌습니다. 아마 일부 Android 관련 항목 –