I know picasso loads image into imageview etc but how do I set my layout background image using picasso?
My code:
public class MainActivity extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.relativelayout);
relativeLayout.setBackgroundResource(R.drawable.table_background);
Picasso.with(MainActivity.this)
.load(R.drawable.table_background)
.resize(200, 200)
.into(relativeLayout);
return relativeLayout;
}
What I have here gives any error saying it cannot be resolved. I have a ScrollView and relative layouts.
Use callback of Picasso
UPDATE:
Please check this also .As @OlivierH mentioned in the comment.
The best way it's create custom Transformation for example for fill color:
Usage:
If you want to add a vectorDrawable image use the Transformation :