Tuesday 3 April 2012

How to use default Android drawables ?

So many people don't know use default android drawables in android project
Here we can see how to use defalut drawables

We can assign (use) defalut drawables 2 ways
 

1)Assign in Programatically (In Activity)
Example:

Button search = (Button) findViewById(R.id.search);
seach.setBackgroundColor(android.R.drawable.ic_search_category_default);


2)Assign in XML (Layout-Resource Usage)

Example:

<Button
        android:id="@+id/search"
        style="?android:attr/buttonStyleSmall"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@android:drawable/ic_search_category_default" />

List of the drawables in Android 1.5:
http://www.darshancomputing.com/android/1.5-drawables.html


No comments:

Post a Comment

Android SQLite Database Viewer or Debuging with Stetho

Every Android Developer uses SQLite Database to store data into the Android Application data. But to view the data in SQLite have a lot of...