Vasant Raval
Vasant Raval

Reputation: 303

How to add custom background colour in native ads

Hello i want to implement a native ad in my app what i want is i can implement my custom colour but i dont know how

here is the line where the colur is to be added

NativeTemplateStyle styles = new
                                NativeTemplateStyle.Builder().withMainBackgroundColor(background_color).build(); 

this is the colour i want to implement it is in the color.xml in the values folder

<color name="Card_Elevation_Color">#2c2c2c</color>

Upvotes: 2

Views: 719

Answers (1)

MArio
MArio

Reputation: 122

ColorDrawable colorDrawable = new ColorDrawable(getColor(R.color.Card_Elevation_Color));
        
NativeTemplateStyle styles = new NativeTemplateStyle.Builder().withMainBackgroundColor(colorDrawable).build();

Upvotes: 1

Related Questions