android listview 自定义样式

lihao583240671 2011-10-10 02:15:59
我是新手才接触android,我想改变listview 背景颜色和大小。
我不知道该怎么做。求教
...全文
322 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2011-10-11
  • 打赏
  • 举报
回复
api里有吧 做ui不看api 光看demo 收效不大啊
小裴同学 2011-10-11
  • 打赏
  • 举报
回复
网上搜个listview代码N多
nulls 2011-10-11
  • 打赏
  • 举报
回复
android:background="@layout/list_corner_1"
背景这样写是可以,就是不知道你的list_corner_1.xml资源文件是怎么写的。
码密码密哄 2011-10-10
  • 打赏
  • 举报
回复
<ListView
android:layout_height="wrap_content" -->这个删掉
android:id="@+id/listView1"
android:layout_width="match_parent" -->这个删掉
android:background="@layout/list_corner_1" -->这个改成@drawable/你的图片名
android:layout_height="20px" -->最好写20dip
android:layout_width="30px" -->30dip
>
</ListView>
看你新手,全给你改下吧
Shan_zha 2011-10-10
  • 打赏
  • 举报
回复
1 你的layout_width和layout_height属性重复了,肯定报错
2 你的背景是@layout,应该也会报错,编译时可能不会,但是运行时就会
lihao583240671 2011-10-10
  • 打赏
  • 举报
回复

<ListView
android:layout_height="wrap_content"
android:id="@+id/listView1"
android:layout_width="match_parent"
android:background="@layout/list_corner_1"
android:layout_height="20px"
android:layout_width="30px"
>
</ListView>


要报错啊
fishmen26 2011-10-10
  • 打赏
  • 举报
回复
在你定义listview 的xml中找到那个listview 然后改变它的android:background属性来设置背景,改变他的 android:layout_height and android:layout_width 来控制大小。

80,362

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧