private View mFooter; mFooter = LayoutInflater.from(this).inflate(R.layout.footer, null); //加载footer的布局 mListView.addFooterView(mFooter);
mFooter.setVisibility(View.GONE); //隐藏footer
layout_footer_listview.xml:(完整版代码) <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mFooterparent" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFFFFF" android:gravity="center" android:orientation="vertical" > <LinearLayout android:id="@+id/mFooter" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="40dp" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:gravity="center" android:text="查看更多" android:textColor="#ff0000" android:textSize="20sp"/> </LinearLayout> </LinearLayout>
private View mFooter; //footer private View mFooterParent; //footer的最外面再套一层LinearLayout mFooterParent = LayoutInflater.from(getActivity()).inflate(R.layout.footerparent_listview, null);//加载footerParent布局 mFooter = mFooterParent.findViewById(R.id.footer); listView.addFooterView(mFooterParent); //把footerParent放到ListView当中 mFooterParent.setOnClickListener(MainActivity.this); //绑定监听事件,点击查看全部列表
mFooter.setVisibility(View.GONE);
private View mFooter; //footer mFooter = LayoutInflater.from(getActivity()).inflate(R.layout.footer_listview, null);//加载footer布局 LinearLayout mFooterParent = new LinearLayout(context); mFooterParent.addView(mFooter);//在footer的最外面再套一层LinearLayout(即footerParent) listView.addFooterView(mFooterParent);//把footerParent放到ListView当中
mFooter.setVisibility(View.GONE);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有