开发者

android shrink a background to the layouts size

开发者 https://www.devze.com 2023-03-08 19:48 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消