android:maxWidth无效

本文分享了关于在Android开发中遇到的android:maxWidth属性失效的问题,并总结了解决方案。关键在于设置android:adjustViewBounds为true且避免将android:layout_width设为match_parent。

android:maxWidth用过几次,之前有效,今天再用就无效了。其实是有两个注意点的,记录下:

1. android:adjustViewBounds="true"

2.android:layout_width不能是match_parent


我的activity_about布局是不是也存在问题?<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" android:padding="20dp"> <!-- 软件名称 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="公交查询系统" android:textSize="28sp" android:textStyle="bold" android:textColor="#000" android:layout_marginBottom="10dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Bus" android:textSize="18sp" android:textColor="#555" android:layout_marginBottom="80dp" /> <!-- 软件图片 --> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/bus" android:layout_marginBottom="100dp"/> <!-- 版本信息 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="版本:1.0" android:textSize="16sp" android:layout_marginBottom="20dp" /> <!-- 开发信息 --> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="开发团队:white luminous" android:textSize="16sp" android:layout_marginBottom="10dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="邮箱:support@busapp.cn" android:textSize="16sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hao" android:textSize="8sp" android:layout_marginTop="100dp" android:textColor="#EEE"/> </LinearLayout>
最新发布
10-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值