1. Create a new android application in Netbeans.
2. Copy your image file to /res/drawable directory
(Note: Name of image file should be in small letter)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEsgMWGWopA9sYnv-1nJpg1tGOj5wsbraKFnziqOXYR3vnxNMfonMNse2X9FK1-QOprODOjGsAT-Oi-IuEqLJ6uaYlyvFFBxQxMUzyAvDu88PBpce9vY_xCsIr9ZThkHqPeSu9MUFaJh8/s1600/Untitled.png)
3 Open main.xml file and add following line to it.
android:background="@drawable/hd_bg"
Here "hd_bg" is image file name without extension.
Your main.xml file should look like this.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCxnZky-jEc8ieAzF2ZGfvg9SZx_ZupGKBDE2OPMJQBGJBFo85y6u68c07Gm-OoO8YNgtV_v9eJoK_Uk5gf9B1_30DF5CVM6LV7Dad4dzWlQr8bruRR8czirXIm1Tv48a_yFIhHVhw5OA/s1600/Capture.PNG)
2. Copy your image file to /res/drawable directory
(Note: Name of image file should be in small letter)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEsgMWGWopA9sYnv-1nJpg1tGOj5wsbraKFnziqOXYR3vnxNMfonMNse2X9FK1-QOprODOjGsAT-Oi-IuEqLJ6uaYlyvFFBxQxMUzyAvDu88PBpce9vY_xCsIr9ZThkHqPeSu9MUFaJh8/s1600/Untitled.png)
3 Open main.xml file and add following line to it.
android:background="@drawable/hd_bg"
Here "hd_bg" is image file name without extension.
Your main.xml file should look like this.
Save and run application.<?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"android:background="@drawable/hd_bg"><TextViewandroid:layout_width="fill_parent"android:layout_height="wrap_content"android:text="Hello World, MainActivity"/></LinearLayout>
No comments:
Post a Comment