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:开发者_StackOverflowgravity="top" android:background="@drawable/background"
android:paddingRight="10dp" android:paddingLeft="10dp" android:paddingTop="10dp">
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.
精彩评论