kgibbon
kgibbon

Reputation: 726

android shrink a background to the layouts size

I want to shrink the background of a layout component to fit the actual contents. The background's will strech automatically but will not shrink.

<LinearLayout android:layout_height="wrap_content"
                android:orientation="vertical" android:layout_width="fill_parent"
                android:gravity="top" android:background="@drawable/background"
                android:paddingRight="10dp" android:paddingLeft="10dp" android:paddingTop="10dp">

Upvotes: 0

Views: 1538

Answers (1)

omermuhammed
omermuhammed

Reputation: 7385

Create the background image as a 9-patch image, save it as the smallest dimensions you want to support, and Android will take care of the rest. You can read up about it here.

Upvotes: 3

Related Questions