Vì vậy, bây giờ Android 5.0 đã được phát hành, tôi đã tự hỏi làm thế nào để tạo kiểu cho các biểu tượng hành động động.Cách tạo kiểu DrawerArrowToggle từ thư viện appcompat v7 21
Thư viện này here thực hiện và phong cách nó phù hợp với tôi nhưng vì thư viện appcompat v7 có nó như thế nào nó có thể được tạo kiểu?
Tôi đã thực hiện việc này bằng cách sử dụng DrawerToggle v7. Tuy nhiên tôi không thể tạo kiểu cho nó. Xin vui lòng giúp
tôi thấy phong cách cho nó trong v7 styles_base.xml
<style name="Base.Widget.AppCompat.DrawerArrowToggle" parent="">
<item name="color">?android:attr/textColorSecondary</item>
<item name="thickness">2dp</item>
<item name="barSize">18dp</item>
<item name="gapBetweenBars">3dp</item>
<item name="topBottomBarArrowSize">11.31dp</item>
<item name="middleBarArrowSize">16dp</item>
<item name="drawableSize">24dp</item>
<item name="spinBars">true</item>
</style>
tôi thêm này để phong cách của tôi và đã không làm việc. Cũng được thêm vào attr.xml của tôi
<declare-styleable name="DrawerArrowToggle">
<!-- The drawing color for the bars -->
<attr name="color" format="color"/>
<!-- Whether bars should rotate or not during transition -->
<attr name="spinBars" format="boolean"/>
<!-- The total size of the drawable -->
<attr name="drawableSize" format="dimension"/>
<!-- The max gap between the bars when they are parallel to each other -->
<attr name="gapBetweenBars" format="dimension"/>
<!-- The size of the top and bottom bars when they merge to the middle bar to form an arrow -->
<attr name="topBottomBarArrowSize" format="dimension"/>
<!-- The size of the middle bar when top and bottom bars merge into middle bar to form an arrow -->
<attr name="middleBarArrowSize" format="dimension"/>
<!-- The size of the bars when they are parallel to each other -->
<attr name="barSize" format="dimension"/>
<!-- The thickness (stroke size) for the bar paint -->
<attr name="thickness" format="dimension"/>
</declare-styleable>
Nhưng treo và nói lỗi loại màu khi làm như vậy. Tôi đang thiếu gì?
Chủ đề cơ sở của tôi không phải là appcompat. Tôi không hỗ trợ api bên dưới 15. Thay đổi chủ đề appcompat cho cơ sở của tôi sẽ thay đổi mọi thứ. – Bignadad
Được rồi tôi đã chuyển đổi mọi thứ sang appcompat, thay đổi fragmentactivity thành actionbaractivity, getactionbar thành getsupportactionbar và đã tạo thanh công cụ. tôi sau đó sử dụng những gì bạn đặt ở trên và vẫn sẽ không hoạt động. thậm chí sẽ không thay đổi màu hoặc tạo hiệu ứng động. tôi có thể làm gì sai? – Bignadad
Ngoài ra tôi đã xem xét công việc của bạn (tuyệt vời) ở đây https://chris.banes.me/2014/10/17/appcompat-v21/ nhưng vẫn không có may mắn. – Bignadad