1. 在业务的实施过程中发现用户要自定义背景,实现发法如下
1.1 首先在服务端可以添加这个图片
1.2 然后在平板电脑上来读取出来如下
///加载自定义背景图片 当背景图片不存在时就显示默认系统图片 图片名称必须是home.png
private void init_bg() {
LinearLayout homeBg = (LinearLayout)findViewById(R.id.homeBg);
String url = "";
url = new FileUtils().getSDBGPath() +"home.png";
try {
if(new File(url).exists()){
Drawable drawable = null;
drawable=Drawable.createFromPath(url);
homeBg.setBackgroundDrawable(drawable);
}
} catch (Exception e) {
e.printStackTrace();
}
}