Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spinner icon color only changes one time programmatically #32

Open
MohamedEmish opened this issue Feb 6, 2022 · 1 comment
Open

Spinner icon color only changes one time programmatically #32

MohamedEmish opened this issue Feb 6, 2022 · 1 comment

Comments

@MohamedEmish
Copy link

MohamedEmish commented Feb 6, 2022

Please complete the following information:

  • Library-Version: v1.0.7
  • Affected Device(s) Google Pixel3 with Android 12 and Huawei Android 8

Describe the Bug:

For the expansion spinner icon, I set its color from the XML file to be gray

<com.skydoves.expandablelayout.ExpandableLayout android:id="@+id/requestFailedExpandLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="@dimen/_12sdp" android:layout_marginEnd="@dimen/_12sdp" app:expandable_duration="300" app:expandable_isExpanded="false" app:expandable_parentLayout="@layout/request_failed_header_layout" app:expandable_secondLayout="@layout/request_failed_body_layout" app:expandable_showSpinner="true" app:expandable_spinner_animate="true" app:expandable_spinner_color="@color/gray_8b8b8b" />

then I added a listener on the layout when it's expanded the icon should be blue else should be gray

setOnExpandListener { if (isExpanding) { parentLayout.backgroundTintList = ContextCompat.getColorStateList(requireContext(), R.color.blue_daebfd) spinnerColor = R.color.colorPrimary parentLayout.findViewById<MaterialTextView>(R.id.tvRecommendationExpandTitle).setTextColor(ContextCompat.getColor(requireContext(), R.color.colorPrimary)) } else { parentLayout.backgroundTintList = ContextCompat.getColorStateList(requireContext(), R.color.gray_c7c7c7) spinnerColor = R.color.gray_8b8b8b parentLayout.findViewById<MaterialTextView>(R.id.tvRecommendationExpandTitle).setTextColor(ContextCompat.getColor(requireContext(), R.color.gray_8b8b8b)) } }

but after one single change, the color never changes again.

Expected Behavior:

the spinner icon color to be always changeable

@MohamedEmish
Copy link
Author

MohamedEmish commented Feb 6, 2022

I fixed that using this line to set the spinner icon color and it worked
((getChildAt(0) as FrameLayout)[1] as ImageView).imageTintList = ContextCompat.getColorStateList(requireContext(), R.color.gray_8b8b8b)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant