Friday, November 27, 2015

Android LinearLayout : Scale a Drawable or background image?


in the drawable/main_framgent_background.xml


<?xml version="1.0" encoding="utf-8"?><bitmap xmlns:android="http://schemas.android.com/apk/res/android"    android:src="@drawable/bg"    android:gravity="top"    ></bitmap>


So easy:


<LinearLayout    android:id="@+id/ll_container"    android:layout_width="match_parent"    android:layout_height="@dimen/dimen_dp_160"    android:orientation="horizontal"    android:descendantFocusability="blocksDescendants"    android:background="@drawable/main_framgent_background"    >
</LinearLayout>


reference:
http://stackoverflow.com/questions/1400782/android-scale-a-drawable-or-background-image

No comments:

Post a Comment