How to add a new style to an image?

0

I'm trying to add a new style to a image, but I'm a bit lost on how to do it, the idea is that on the image below it appears a colored bar with a text - "new employee", I'm trying to create a new style, but I do not know if this is the best way to do it ... I hope someone can help me.

style.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="estilo1">
    <item name="android:textColor">#a34141</item>
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">15dp</item>
    <item name="android:text">Nuevo</item>
    <item name="android:background">#41a359</item>
</style>
</resources>

<ImageView
        android:id="@+id/imageView"
        android:layout_width="149dp"
        android:layout_height="205dp"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="60dp"
        android:style="@values/style.xml"
        android:src="@drawable/empl1"
        style="@style/estilo1" />

    
asked by Pedro 23.07.2018 в 21:31
source

1 answer

0

You can add styles to an img this way:

<style name="TitleBarImage">     
<item name="android:layout_width">wrap_content</item>     
<item name="android:layout_height">wrap_content</item>     
<item name="android:src">@drawable/whiteButton</item> 

more info here

    
answered by 23.07.2018 в 22:05