Sharing Knowledge

« Norton Smartphone... | Main | Android Browser »
Monday Jun 21, 2010

Android Background

Untuk memperindah aplikasi dan menghindari kebosanan, kita bisa mengganti background emulator Android. Kita bisa menambahkan background color atau background image.

1. Background Color
Untuk menambahkan background color ini, caranya sangat mudah sekali.  Anda hanya perlu menambahkan statement android:background di file xml.

main.xml

 <?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="#444aaa">
</LinearLayout>


Gambar 1 Android background color



2. Background image
Sama dengan mengubah background color, untuk menambahkan background image berikan statement android:background pada file xml beserta nama imagenya. Simpan image di folder res / drawable

main.xml
 <?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/background">
</LinearLayout>



Gambar 2 Android background image




netoya_meruvian

Comments:

Post a Comment:
  • HTML Syntax: Allowed