关于wrap_content包裹.9图片的问题

解决Android图片背景撑大问题
本文探讨了在Android应用中使用wrap_content属性时图片背景撑大的问题,并提供了使用padding属性=0dip的解决方案,避免了图片过大导致的布局问题。

android所以.9图片作为背景,然后使用wrap_content属性包裹。 会出现将整个图片的撑大的情况。

此处俺使用了padding 属性 = 0dip来指定,就没有出现该情况了

<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingStart="34dp" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Today" android:textColor="@color/gray_99999" android:layout_marginTop="15dp"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="15dp" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/gray333" android:textStyle="bold" android:text="12.1" android:textSize="23sp"/> <TextView android:layout_marginStart="3dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12sp" android:textColor="@color/gray333" android:text="h"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/gray333" android:textStyle="bold" android:text="125.1" android:textSize="23sp"/> <TextView android:layout_marginStart="3dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12sp" android:textColor="@color/gray333" android:text="Kmh"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/gray333" android:textStyle="bold" android:text="992.3" android:textSize="23sp"/> <TextView android:layout_marginStart="3dp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12sp" android:textColor="@color/gray333" android:text="Kmh"/> </LinearLayout> 我想让xxh,xxkmh,xxkmh,这三个平分
08-20
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值