Hey guys, I’m facing an issue with an Android libr...
# android
s
Hey guys, I’m facing an issue with an Android library module that contains a custom view created using XML, which has been converted to a composable using
AndroidView
. When I render the preview within the library, it works as expected. However, when I add this library as a remote dependency and preview the composable, the UI is displayed differently. Specifically: • The expected behavior shows a clickable "Text" element. • The unexpected behavior displays a filled button with a colored background. Any suggestions to resolve this issue?
s
Is this just a preview problem or it's same when you run the app as well
s
its preview problem, when app is running it shows expected result
s
Can you share the code here for more context
I am assuming when the library is compiled and imported as a external dependency the tools: namespace attributes are getting removed That may be the reason you are not able to see the expected preview
c
FYI there’s #C04TPPEQKEJ for compose related questions.
👍 1
s
@Sagar yadav instead of using color in this format <item android:color="?colorBgDisabled" android:state_enabled="false" /> i hardcoded the value and i was able to preview the button
Copy code
<selector xmlns:android="<http://schemas.android.com/apk/res/android>">
  <item android:color="?colorBgDisabled" android:state_enabled="false" />
  <item android:color="?colorMainPrimaryBold" android:state_pressed="true" />
  <item android:color="?colorMainPrimary" />
</selector>
🙌 1
is there any way to look fetch the reference apart from "?xyz" or "@attr/xyz"