let see a simple procedure for setting background image for activity its easy two step procedure
1. copying desired jpeg or png file to drawble folder
2. setting it in xml file
select a image which you want to set as background for an activity just copy it right click and say copy or cntrl+c either one is ok then go to res folder and drawblehdpi click on drawblehdpi and paste
cntrl+V or right click and paste you can see your image in drawble folder now
now second step setting up image in xml file you can do it in easy way or hard way
easy way is to go to xml file in layout it woulbe be something like this
<linearlayout android:gravity="center" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
</linearlayout>
just add following tag android:background="@drawable/urimage" dont use png or jpeg here
<linearlayout android:gravity="center" android:layout_height="match_parent" android:layout_width="match_parent" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
android:background="@drawable/urimage"
</linearlayout>
now the code will look as above
and simple and easy way to do it is switch to graphical view of layout
right click on it and say show in properties and then go to categori view and background jsut browse and select the image you want to set up its just easy to do</div>
No comments:
Post a Comment