Tôi vừa xem mã nguồn Ice Cream Sandwich, vì tôi đang cố gắng chuyển chủ đề Holo đến tất cả các thiết bị trước 4.0.Nút tìm kiếm ICS: tôi có thể chọn trong ICS SDK ở mức nào?
tôi đã sử dụng nhiều công cụ hữu ích:
Action Bar: ActionBarSherlock
ICS nền:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:startColor="#ff020202"
android:endColor="#ff272D33d"
android:type="linear" />
</shape>
và cho đến bây giờ, tất cả mọi thứ chỉ là tuyệt vời !!!
bây giờ tôi đang cố gắng để tạo ra một nút, nhưng không thể tìm thấy nền đúng:
Tiếp theo nguồn: https://github.com/android/platform_frameworks_base/blob/master/core/res/res/drawable/btn_default.xml
Tôi cố gắng này:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true"
android:drawable="@drawable/btn_default_normal" />
<item android:state_window_focused="false" android:state_enabled="false"
android:drawable="@drawable/btn_default_normal_disable" />
<item android:state_pressed="true"
android:drawable="@drawable/btn_default_pressed" />
<item android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/btn_default_selected" />
<item android:state_enabled="true"
android:drawable="@drawable/btn_default_normal" />
<item android:state_focused="true"
android:drawable="@drawable/btn_default_normal_disable_focused" />
<item
android:drawable="@drawable/btn_default_normal_disable" />
Và tôi sao chép mỗi tệp .9.png vào thư mục drawable của tôi.
Nhưng Thật không may, tất cả những drawable có vẻ khá trắng và tôi không thể có được một cái gì đó tương tự như nút này:
Dưới đây là tất cả các tài nguyên:
btn_default_normal_holo_dark.9.png
btn_default_normal_holo_light.9.png
btn_default_normal.9.png