tạo tiêu đề tùy chỉnh của bạn và footer với mã xem danh sách của bạn như sau
tập tin header.xml
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="your custom height" // you may set default too
/>
</RelativeLayout>
chân .tập tin xml
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
add nơi listview của bạn
LayoutInflater inflaterHeader = getLayoutInflater();
ViewGroup header = (ViewGroup) inflaterFooter.inflate(
R.layout.header, list_view, false);
yourListView.addHeaderView(header);
LayoutInflater inflaterFooter = getLayoutInflater();
ViewGroup footer = (ViewGroup) inflaterFooter.inflate(
R.layout.footer, list_view, false);
yourListView.addFooterView(footer);
Điều đó phù hợp với bố cục tuyến tính của tôi mà không có nhiều thay đổi. Cảm ơn – Veeru