2013-08-06 34 views
5

Tôi đang sử dụng thư viện hỗ trợ v7 trong dự án của mình. Cài đặt tệp kê khai của tôi là:Android: trình đơn chèn kiểu dáng trong thanh tác vụ

android:minSdkVersion="7" 
    android:targetSdkVersion="15" 

Tôi đã sử dụng Trình tạo kiểu thanh tác vụ Android để tạo kiểu cho Thanh tác vụ của mình. Vấn đề là trong khi tất cả mọi thứ hoạt động cho apis mới nhất, trình đơn tràn của tôi không thay đổi trong apis thấp (thử nghiệm trên giả lập 2.2 và thiết bị thực 2.3.3 htc mong muốn).

1
(điều này nên có nền đỏ)

là đơn tràn tải các mục trong một số thành phần khác như thoại spinner hoặc một cái gì đó (sry nếu điều đó nghe có vẻ ngớ ngẩn)? Tại sao phong cách cho một api (ví dụ 15) không áp dụng cho khác (ví dụ 8), và có bất cứ điều gì tôi có thể làm để có menu tràn tương tự cho tất cả các phiên bản api.

Đây là phong cách được tạo ban đầu của tôi từ Trình tạo Kiểu Action Bar mà tôi đã chỉnh sửa rất nhiều nhưng không thành công.

<resources> 

<style name="Theme.Example" parent="@style/Theme.AppCompat.Light.DarkActionBar"> 
    <item name="actionBarItemBackground">@drawable/selectable_background_example</item> 
    <item name="popupMenuStyle">@style/PopupMenu.Example</item> 
    <item name="dropDownListViewStyle">@style/DropDownListView.Example</item> 
    <item name="actionBarTabStyle">@style/ActionBarTabStyle.Example</item> 
    <item name="actionDropDownStyle">@style/DropDownNav.Example</item> 
    <item name="actionBarStyle">@style/ActionBar.Solid.Example</item> 
    <item name="actionModeBackground">@drawable/cab_background_top_example</item> 
    <item name="actionModeSplitBackground">@drawable/cab_background_bottom_example</item> 
    <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Example</item> 

      <!-- Light.DarkActionBar specific --> 
    <item name="actionBarWidgetTheme">@style/Theme.Example.Widget</item> 

</style> 

<style name="ActionBar.Solid.Example" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse"> 
    <item name="background">@drawable/ab_solid_example</item> 
    <item name="backgroundStacked">@drawable/ab_stacked_solid_example</item> 
    <item name="backgroundSplit">@drawable/ab_bottom_solid_example</item> 
    <item name="progressBarStyle">@style/ProgressBar.Example</item> 
</style> 

<style name="ActionBar.Transparent.Example" parent="@style/Widget.AppCompat.ActionBar"> 
    <item name="background">@drawable/ab_transparent_example</item> 
    <item name="progressBarStyle">@style/ProgressBar.Example</item> 
</style> 

<style name="PopupMenu.Example" parent="@style/Widget.AppCompat.PopupMenu"> 
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item> 
</style> 

<style name="DropDownListView.Example" parent="@style/Widget.AppCompat.ListView.DropDown"> 
    <item name="android:listSelector">@drawable/selectable_background_example</item> 
</style> 

<style name="ActionBarTabStyle.Example" parent="@style/Widget.AppCompat.ActionBar.TabView"> 
    <item name="android:background">@drawable/tab_indicator_ab_example</item> 
</style> 

<style name="DropDownNav.Example" parent="@style/Widget.AppCompat.Spinner.DropDown.ActionBar"> 
    <item name="android:background">@drawable/spinner_background_ab_example</item> 
    <item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item> 
    <item name="android:dropDownSelector">@drawable/selectable_background_example</item> 
</style> 

<style name="ProgressBar.Example" parent="@style/Widget.AppCompat.ProgressBar.Horizontal"> 
    <item name="android:progressDrawable">@drawable/progress_horizontal_example</item> 
</style> 

<style name="ActionButton.CloseMode.Example" parent="@style/Widget.AppCompat.ActionButton.CloseMode"> 
    <item name="android:background">@drawable/btn_cab_done_example</item> 
</style> 

<!-- this style is only referenced in a Light.DarkActionBar based theme --> 
<style name="Theme.Example.Widget" parent="@style/Theme.AppCompat"> 
    <item name="popupMenuStyle">@style/PopupMenu.Example</item> 
    <item name="dropDownListViewStyle">@style/DropDownListView.Example</item> 
</style> 

Trả lời

3

tôi đã làm nó theo cách này:

<style name="Theme.yourapp" parent="@style/Theme.AppCompat.Light.DarkActionBar"> 
    <item name="android:actionBarWidgetTheme">@style/Theme.yourapp.Widget</item> 
</style> 

<style name="Theme.yourapp.Widget" parent="@style/Theme.AppCompat"> 
    <item name="android:textColor">@android:color/black</item> 
</style> 
2

Để đơn giản, không gian tên android: gắn liền với bất cứ điều gì được xây dựng vào hệ điều hành, trong khi bất cứ điều gì mà không android: như không gian tên sẽ liên quan đến ứng dụng của bạn (và các thư viện bạn đang sử dụng). Hầu hết, nếu không phải tất cả, thư viện hỗ trợ cho ActionBar sẽ cố gắng sử dụng triển khai ActionBar gốc và sử dụng thuộc tính không gian tên android: trong kiểu của bạn. Khi ActionBar gốc không có sẵn, nó sẽ sử dụng việc triển khai thư viện và các thuộc tính không phải tên là android:. Đây là lý do tại sao bạn phải chỉ định mọi thuộc tính có và không có không gian tên android:.

+0

thực sự tôi đã làm. không có hiệu lực mặc dù .. tôi bị mất vài giờ để thấy rằng thanh toán bù trừ đánh dấu lint loại bỏ nhật thực cảnh báo đã cho tôi. bạn có thể chỉ định các thuộc tính cần được ghi lại một lần nữa với android: namespace .. có thể tôi đang làm điều gì sai. – BlastFire

+0

Bạn có đang sử dụng đúng thư mục không? bạn nên có ít nhất 'giá trị',' giá trị-v11' với thuộc tính không gian tên android trong 'giá trị-11'. – JRomero

+0

tốt, tôi có hai giá trị thư mục được tạo bởi trình tạo kiểu AB. giá trị và giá trị-v14. trong các thuộc tính values ​​được sử dụng mà không có android: namespace và trong values-v14 WITH android: – BlastFire

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