Open MohamedEmish opened 2 years ago
Please complete the following information:
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
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)
((getChildAt(0) as FrameLayout)[1] as ImageView).imageTintList = ContextCompat.getColorStateList(requireContext(), R.color.gray_8b8b8b)
Please complete the following information:
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