dialog:
private void showDialog(JSONObject object,TbgcActivity context) {
View view = LayoutInflater.from(this).inflate(R.layout.dialog_dc_tbgc, null);
ListView lvGc = (ListView) view.findViewById(R.id.lv_dwgc_tbgc_dialog);
//addFooterView的参数为一个View就可以。LayoutInflater.from参数是context,我用的是Fragment所以用getActivity()获取context。
//listview_foot_view是一个布局文件,直接new一个控件作为addFooterView的参数貌似也是可以的
lvGc.addFooterView(LayoutInflater.from(this).inflate(R.layout.listview_foot_view, null));
....
....
....
}
listview_foot_view:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:background="@color/grayList"
>
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dp"
android:src="@color/grayList"
/>
</LinearLayout>
如下图的dialog的确定按钮的上方的深灰色部分

本文介绍如何在Android应用中使用自定义Dialog,并详细解释了如何为ListView添加FooterView,包括使用LayoutInflater从资源文件中加载布局的过程。通过具体代码示例展示了如何实现这一功能。
1270

被折叠的 条评论
为什么被折叠?



