Here's what I have :
MyButton.java
public class MyButton extends AppCompatButton implements Target {
public MyButton(Context context) {
super(context);
}
public MyButton(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyButton(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
setBackgroundDrawable(new BitmapDrawable(bitmap));
}
@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable placeHolderDrawable) {
}}
In my Fragment I have this :
MyButton BteyoutubePlay;
BteyoutubePlay = (MyButton) v.findViewById(R.id.BteyoutubePlay);
Picasso.get().load(R.drawable.gris_xml).into(BteyoutubePlay);
And here's my gris_xml.xml :
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#8E8D8D"/>
<corners android:radius="15dp"/>
</shape>
</item>
<item android:drawable="@drawable/g_drawable"></item>
So everything here works, BUT Picasso won't load my layout, it's working if I replace :
Picasso.get().load(R.drawable.gris_xml).into(BteyoutubePlay);
by :
Picasso.get().load(R.drawable.g_drawable).into(BteyoutubePlay);
So basically putting the image, instead the layout, I'm using the layout because it makes the button corners rounded and I add a color in it ...
If somebody know how I can achieve this, it will be really helpful !
Thanks :) Cordially, LooK