Tôi đã tìm kiếm và thử nghiệm để đặt hình ảnh/biểu tượng của riêng mình trong Spinner nhưng tôi gặp lỗi.Android: Cách đặt bộ chọn xoay tròn để sở hữu hình ảnh/biểu tượng?
Tôi có độ đồng nhất với hình nền được đặt kiểu tạo nhưng sau đó biểu tượng quay tròn ở bên phải không hiển thị nữa.
Khi tôi làm như tôi tìm thấy một ví dụ về như thế này:
<Spinner style="@style/Spinner" android:spinnerSelector="@drawable/myspinner_selector" />
Và đây là myspinner_selector.xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_first="true"
android:drawable="@drawable/arrowdown"
/>
<item android:state_middle="true"
android:drawable="@drawable/arrowdown"
/>
<item android:state_last="true"
android:drawable="@drawable/arrowdown"
/>
<item android:state_single="true"
android:drawable="@drawable/arrowdown"
/>
Nhưng đó là trong XML
đầu tiên cho spinner Tôi nhận được lỗi này:
No resource identifier found for attribute 'spinnerSelector' in package 'android' `main.xml`
Tất cả các ví dụ tôi có thể tìm thấy trên internet bằng cách sử dụng kiểu dáng của bộ chọn spinner như thế này nhưng tôi không thể làm cho nó hoạt động và không thể tìm thấy spinnerSelector
trong hướng dẫn tham khảo trên developer.android.com.