2010-07-13 31 views
7

Bạn có thể cho tôi biết cách sử dụng biểu tượng của android expander_ic_maximized không? Tôi thấy rằng trong khuôn khổ/cơ sở/lõi/res/res/drawable-hdpi/expanderic_minimized.9.pngTôi làm cách nào để sử dụng biểu tượng được hệ thống cung cấp trong Android (ví dụ: expander_ic_maximized)

Dưới đây là cách bố trí file xml của tôi:

<ImageView android:id="@+id/icon" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/expander_ic_minimized"> 

Nhưng tôi nhận được lỗi này:

res/layout/test.xml:70: error: Error: Resource is not public. (at 'src' with value '@android:drawable/expander_ic_maximized'). 

Trả lời

1

có lẽ chỉ cần tải và bao gồm nó trong dự án của bạn

nhận được nó từ expander_ic_maximized.9.png bằng cách nhấn vào liên kết Xem file raw

3

Theo this thread, bạn sẽ phải sao chép biểu tượng đó vào dự án của mình theo cách thủ công và sử dụng nó từ đó.

4

Bạn có thể tìm thấy tất cả các biểu tượng android trong thư mục cài đặt SDK Android của mình. F.ex. /opt/android-sdk-linux/platforms/android-16/data/res/drawable-hdpi/ trên máy tính của tôi. Có các bộ biểu tượng khác nhau cho các phiên bản Android khác nhau và cho các độ phân giải màn hình khác nhau. Sao chép expander_ic_minimized.png tệp vào dự án của bạn drawable thư mục và biểu tượng sẽ có sẵn.

Theo android phát triển guide:

Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. menu icons under android.R.drawable). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system's copy changes.

Các vấn đề liên quan