相关疑难解决方法(0)

如何在代码中使用picasso设置背景图像

我知道毕加索将图像加载到imageview等,但如何使用毕加索设置我的布局背景图像?

我的代码:

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;
    }
Run Code Online (Sandbox Code Playgroud)

我在这里给出了任何错误,说它无法解决.我有一个ScrollView和相对布局.

java android android-scrollview picasso android-relativelayout

25
推荐指数
1
解决办法
2万
查看次数