Android ListView 去除边缘阴影、选中色、拖动背景色、行高、addFootView等

发布于:2021-07-31 12:18:09

去除ListView滑到顶部和底部时边缘的黑色阴影:




android:fadingEdge="none"?








----------------------------------------------------



去除拖动时默认的黑色背景:




android:cacheColorHint="#00000000"??










listView.setCacheColorHint(Color.TRANSPARENT);







----------------------------------------------------



去除选中时的黄色底色:




android:listSelector="#00000000"









listView.setSelector(
new
?ColorDrawable(Color.TRANSPARENT));





---------------------------------------------------



去除行与行之间的黑线:




android:divider="?#00000000?"









listView.setDivider(
null
);









---------------------------------------------------



ListView刷新后自动滚到最底部:




listView.setSelection(?listView?.getAdapter().getCount()
-
1
);

?


去掉滑动条:


android:scrollbars="none"


?


设置最小行高:


在item xml文件中根元素设置:android:minHeight="xxdip"


?


给listview添加addFootView:


?View footView=getLayoutInflater().inflate(R.layout.footview, null);
??????? listview.addFooterView(footView);
??????? listview.setAdapter(adapter);

相关推荐

最新更新

猜你喜欢