ExpandableCardView
ExpandableCardView copied to clipboard
Custom Attribute Background Color of Card and Title
Can I change the title and background color of the Card in ExpandableCardView? Thank you
HI @AleSpero
Thanks for your great library . I have same problem . is there any way change header section's background/text color ?
Hello,
Thank you for choosing this library and sorry for the late reply,
I will add soon methods to change the card background. In the meantime, you can change che background in this way:
val myCard = findViewById(R.id.myCard)
myCard.findViewById(R.id.card).setBackground() //Or size, or radius, or everything you like.
Inside the ExpandableCardView there's a CardView whose identifier is R.id.card. You can get that specific view using findViewByid
and then change the background.
The same applies to the header: inside the ExpandableCardView there's a linearlayout whose id is R.id.header. You can safely use that to change anything you want.
PS: If you want your app to be featured in the readme, please ask :)
Thank you!
Alessandro
im unable to define
val myCard = findViewById(R.id.myCard)
please help
Check the id of your card. Check if the id myCard is correct for you.
Alternatively, you can change the background in the xml file. In, expandable_cardview.xml file, you can do something like:
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/card" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardBackgroundColor="@android:color/darker_gray">
<LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
Thanks brother.
On Mon, Oct 8, 2018 at 3:05 PM Shubham [email protected] wrote:
Check the id of your card. Check if the id myCard is correct for you.
Alternatively, you can change the background in the xml file. In, expandable_cardview.xml file, you can do something like:
<android.support.v7.widget.CardView xmlns:android=" http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/card" android:layout_width="match_parent" android:layout_height="wrap_content" app:cardBackgroundColor="@android https://github.com/android :color/darker_gray">
</android.support.v7.widget.CardView>
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/AleSpero/ExpandableCardView/issues/13#issuecomment-427773381, or mute the thread https://github.com/notifications/unsubscribe-auth/Alz2-lP7hdDOlj-aYXK5UpywBLz_qaYnks5uixxbgaJpZM4VlPrw .
How can I change the title and arrow's color? And how can i hide the arrow icon if possible? Thankyou
cannot change the size of title