2015-09-06 15 views
8

Tôi cần trợ giúp. Làm thế nào tôi có thể thay đổi thiết kế của văn bản trong snackbar trong phong cách ứng dụng? Sự thay đổi trong mã không quan tâm đến tôi. Tôi tìm thấy đoạn mã sau. Nhưng nó không làm việc cho tôi. Tại sao vậy? .. Chủ đề của tôi có nguồn gốc từ @ style/Theme.AppCompat.Light.DarkActionBar" Tôi sẽ rất biết ơn đối với sự giúp đỡKiểu SnackBar trong ứng dụng chủ đề

<style name="TextAppearance.Design.Snackbar.Message" parent="android:TextAppearance"> 
     <item name="android:textSize">10sp</item> 
     <item name="android:textColor">#FEFEFE</item> 
    </style> 
    <style name="TextAppearance.Design.Snackbar.Action" parent="android:TextAppearance"> 
     <item name="android:textSize">16sp</item> 
     <item name="android:textColor">#FEFEFE</item> 
    </style> 

Trả lời

9

bạn cần điều này: tools:override="true"

<resources xmlns:tools="http://schemas.android.com/tools"> 
    <style name="TextAppearance.Design.Snackbar.Message" parent="android:TextAppearance" tools:override="true"> 
     <item name="android:textColor">@color/text</item> 
     <item name="android:textSize">50sp</item> 
    </style> 
</resources> 
+1

Đây là cách duy nhất để phong cách nó trong XML như ngay bây giờ Có một [báo cáo lỗi] (https://code.google.com/p/android/issues/detail?id=223344) để cho phép tạo kiểu cho đúng. –

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