`
dingran
  • 浏览: 371642 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Android ListView的addHeaderView注意事项

 
阅读更多
Android ListView的addHeaderView注意事项


addHeaderView(heightView, null, false);

heightView这个view如果是从

View view = mInflater.inflate(R.layout.information_playdata_bottom, null);

layout文件转化过来的,那么这个布局文件必须是ViewGroup的根布局,例如LinearLayout或者
其他Layout,里面可以放置一些View.

如果图省事,比如想要heightView只是个不能选择的普通占位占高度的一个View,那么还是不能省事,应该在如此:

<?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="wrap_content" >

    <View
        android:layout_width="match_parent"
        android:layout_height="30dip" />

</LinearLayout>
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics