Tôi muốn tùy chỉnh biểu tượng quay lại và rõ ràng trong SearchView khi nó sụp đổ. Yêu cầu của tôi là thay đổi màu thành trắng nhưng bây giờ nó là màu đen. (Vui lòng tham khảo hình ảnh được chia sẻ bên dưới). Tôi đang tìm cách khắc phục vấn đề này trong một vài ngày, nhưng không có giải pháp nào mà tôi đã cố gắng không làm việc. Tôi cố gắng vài trong số các giải pháp đề nghị từ SO như như sau:Thay đổi màu SearchView của biểu tượng trở lại và rõ ràng trong Thanh công cụ Android
Giải pháp 1:
<style name="AppTheme" parent="@style/Theme.Base.AppCompat.Light.DarkActionBar">
<item name="actionBarWidgetTheme">@style/YourActionBarWidget</item>
</style>
<style name="YourActionBarWidget" parent="@style/Theme.AppCompat">
<item name="searchViewCloseIcon">@drawable/xxx</item>
</style>
Giải pháp 2:
final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
upArrow.setColorFilter(getResources().getColor(R.color.WHITE), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);
Dự án của tôistyles.xml
<style name="ToolBarTheme" parent="@style/Theme.AppCompat.Light">
<item name="colorPrimary">@color/blue</item>
<item name="colorPrimaryDark">@color/blue</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:itemTextAppearance">@style/myCustomMenuTextApearance</item>
<item name="android:actionMenuTextColor">@color/white</item>
<item name="actionMenuTextColor">@color/white</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@color/white</item>
<item name="gapBetweenBars">2.5dip</item>
<item name="thickness">2dp</item>
</style>
Ảnh chụp màn hình của vấn đề chính xác của tôi:
Vui lòng hãy giúp tôi giải quyết vấn đề của tôi. Bất kỳ loại giải pháp và đề xuất nào cũng hữu ích cho tôi. Cảm ơn sự hỗ trợ của bạn.
bạn đã thử ghi đè ngăn kéoToggle – Ramesh
@Ramesh Cảm ơn câu trả lời của bạn. Vui lòng kiểm tra câu trả lời cập nhật của tôi – Chandru
retionale đằng sau chủ đề của bạn mở rộng Theme.AppCompat.Light – Ramesh