Tôi có thể vẽ như thế này:Drawable.setState() Làm cách nào để kiểm soát trạng thái cụ thể của đối tượng có thể vẽ?
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:state_window_focused="true"
android:drawable="@drawable/seek_thumb_pressed" />
<item android:state_focused="true"
android:state_window_focused="true"
android:drawable="@drawable/seek_thumb_selected" />
<item android:state_selected="true"
android:state_window_focused="true"
android:drawable="@drawable/seek_thumb_selected" />
<item android:drawable="@drawable/seek_thumb_normal" />
Trong mã, làm thế nào để thiết lập nhà nước cụ thể drawable của tôi? Tôi muốn đặt nó thành state_pressed = true state.
gì nếu quan điểm hiện tại không có một nền tảng, và cần phải thông báo cho con của nó về trạng thái của nó (vì họ có android: duplicateParentState = "true")? bạn sẽ thay đổi trạng thái của chế độ xem như thế nào? –
"Nó có ý nghĩa hơn trong mã" - không có gì liên quan đến các trạng thái có thể vẽ được ... – milosmns