Skip to content Skip to sidebar Skip to footer

How To Set Image In Background Display?

I want to set a image in background of App? How to set this?

Solution 1:

Put your background PNG in the 'drawable' resources folder (we assume it's mybackground.png in our snippets).

If you use the XML layouts add the following to your top level container element:

android:background="@drawable/mybackground"

For example:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

Or if you construct your view dynamically, then do the following in the Activity onCreate method:

view.setBackgroundDrawable(R.drawable.mybackground)

Post a Comment for "How To Set Image In Background Display?"