[英]change background image by user in android
I have 2 images bg.jpg
and bg2.jpg
in drawable-hdpi
folder in my app. 我的应用程序的
drawable-hdpi
文件夹中有2张图像bg.jpg
和bg2.jpg
。
I want show list of picture then user select one picture for background image for app. 我要显示图片列表,然后用户为应用程序的背景图像选择一张图片。
And who i can get list of file in drawable-hdpi folder 以及我可以在drawable-hdpi文件夹中获取文件列表的人
Google--> Android How to change background dinamically --> 10000000 results --> first result--> A friend of stackoverflow: 谷歌-> Android的如何改变背景-> 10000000个结果->第一个结果->一个stackoverflow的朋友:
how to change the xml background in android dynamically? 如何动态更改android中的xml背景?
LinearLayout root=(LinearLayout)findViewById(R.id.root);
if(select 1st picture)
{root.setBackgroundResource(R.drawable.bg_image1);}
else
{root.setBackgroundResource(R.drawable.bg_image2);}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.