【问题标题】:change background image by user in android在android中由用户更改背景图像
【发布时间】:2014-05-19 15:49:38
【问题描述】:

我的应用程序的drawable-hdpi 文件夹中有两张图片bg.jpgbg2.jpg

我想显示图片列表,然后用户选择一张图片作为应用的背景图片。

我可以得到drawable-hdpi文件夹中的文件列表

【问题讨论】:

  • 将用户选择的图像存储在共享偏好中的布尔变量中,并简单地动态显示背景图像
  • 谁可以得到drawable-hdpi文件夹中的文件列表
  • 你不能明白,但你当然可以保存用户选择的选项,然后根据选择显示背景
  • 感谢您的帮助非法争论

标签: android background


【解决方案1】:

Google--> Android 如何动态更改背景--> 10000000 个结果--> 第一个结果--> stackoverflow 的朋友:

how to change the xml background in android dynamically?

LinearLayout root=(LinearLayout)findViewById(R.id.root);
if(select 1st picture)
{root.setBackgroundResource(R.drawable.bg_image1);}
else
{root.setBackgroundResource(R.drawable.bg_image2);}

【讨论】:

    猜你喜欢
    • 2013-09-07
    • 1970-01-01
    • 1970-01-01
    • 2016-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-18
    相关资源
    最近更新 更多