开发者

Dynamic Branding on Android

My requirement is that i need to change all the images and colors at run time. But as far as i know the images needs to be in the drawable folders. So my question is, after i export the apk file will i be able to download the images from a server through the application and set them as the images in the app?

For an example, lets say i have a linear 开发者_运维技巧layout with a background image which is in my drawable folder. After installing the app in the device can i download an image from a server and set it as the background of the linear layout?

I hope i have made the question clear. Any help would be greatly appreciated.

Thanks in advance.


try this one (i posted my version for FrameLayout, Imageview should be similar):

String myJpgPath = "/sdcard/picture.jpg";
Bitmap image_b = BitmapFactory.decodeFile(myJpgPath);
final BitmapDrawable image_d = new BitmapDrawable(image_b);
final FrameLayout main = (FrameLayout) findViewById(R.id.main_view);
main.setBackgroundDrawable(image_d);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜