Dialog dlg = new Dialog(context);
LayoutInflater li = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = li.inflate(R.layout.my_layout, null, false);
dlg.setContentView(v);
dlg.show();
my_layout.xml:
<ScrollView xmlns:android="blah"
android:id="xid"
android:layout_height="h"
android:layout_width="w">
<ListView blah blah blah attributes
/>
</ScrollView>
创建自定义布局对话框
本文介绍如何使用LayoutInflater从特定的XML布局文件(my_layout.xml)中加载视图,并将其设置为Dialog的内容视图,最终显示该对话框。此过程涉及ScrollView和ListView组件的使用。
627

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



