3

我有一個使用ActionBarSherlock的應用程序,我有一個擴展超出SherlockPreferenceActivity的偏好屏幕:圖標在SherlockPreferenceActivity沒有顯示在薑餅(2.3)

public class SettingsActivity extends SherlockPreferenceActivity 

我的選擇XML看起來像:

<Preference 
    android:icon="@drawable/settings_prefs_call_settings" 
    android:key="pref_btn_call_settings" 
    android:summary="Change call settings" 
    android:title="Call Settings" /> 

<Preference 
    android:icon="@drawable/call_settings_prefs_my_phone_number" 
    android:key="pref_btn_my_phone_number" 
    android:summary="Change settings relating to your phone number" 
    android:title="My Phone Number" /> 

當我在Android 2.3上運行這個時,圖標(@drawable/call_settings_prefs_my_phone_number@drawable/settings_prefs_call_settings)從不顯示在首選項屏幕上,但在ICS和JB上顯示正常。

任何人都可以告訴我如何讓圖標顯示在GB上嗎?

+0

我遇到同樣的問題。查看首選項文檔,圖標屬性被添加到API級別1.但是,當我嘗試使用.setIcon(int)以編程方式設置圖標時,它表示該方法是在API級別11中引入的。因此,可能已添加圖標屬性在API級別11? – Joris

回答

1

首選項的圖標只被Api 11 +支持。因此是ActionBarSherlock。