开发者

Using an image as the parent Activity (interface)

开发者 https://www.devze.com 2023-03-22 19:04 出处:网络
Is it possible to use an image as the background of the main Activity? (load screen).I then want to put buttons over the image. If this is possible could anyone tell me how I would loa开发者_StackOver

Is it possible to use an image as the background of the main Activity? (load screen). I then want to put buttons over the image. If this is possible could anyone tell me how I would loa开发者_StackOverflow社区d the image into my main Activity? Or send me to a site that would go over this?

Thanks :)


I use the following to set a background image for an Activity..

View view = getWindow().getDecorView();
int orientation = getResources().getConfiguration().orientation;
if (Configuration.ORIENTATION_LANDSCAPE == orientation) {
    view.setBackgroundResource (R.drawable.bground_land);
} else {
    view.setBackgroundResource (R.drawable.bground_port);
}

bground_land.jpg and bground_port.jpg are images in my project's /res/drawable directory.

0

精彩评论

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

关注公众号