在drawable里面新建一个xml文件
那listview的background设成这个资源文件就行了,不会出现变形
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <shape xmlns:android="http://schemas.android.com/apk/res/android"> |
3 | <solid android:color="#FFFFFFFF" /> |
4 | <corners android:topLeftRadius="10px" |
5 | android:topRightRadius="10px" android:bottomLeftRadius="10px" |
6 | android:bottomRightRadius="10px"/> |
7 | <padding android:left="0dp" android:top="0dp" android:right="0dp" |
8 | android:bottom="0dp" /> |
9 | </shape> |
本文提供了一个在Android中使用XML定义ListView背景的方法。通过一个具体的shape XML文件示例,展示了如何设置一个带有圆角和填充效果的背景。这种方法可以避免在运行时动态调整背景造成的界面变形。
3780

被折叠的 条评论
为什么被折叠?



