android自定义对话框
2012-02-08 17:04
357 查看
布局文件
agg_attack_text_list.xml
JAVA代码
agg_attack_text_list.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@+id/text_attack_text_list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="所需物品"/> <ListView android:id="@+id/list_attack_text_list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/transparent"/> </LinearLayout>
JAVA代码
public class AggKillGhostGoodsListDlg extends AlertDialog { private final Context mContex; TextView mMessage = null; ListView mListView = null; MyListAdapter mMyAdapter = null; @Override protected void onCreate(Bundle savedInstanceState) { //此处仅一个简单的TextView,可以扩展到自定义xml里面 LayoutInflater factory = LayoutInflater.from(mContex); LinearLayout layout =(LinearLayout) factory.inflate(R.layout.agg_attack_text_list, null); setTitle(mContex.getResources().getString(R.string.kill_ghost_need_goods)); setButton(mContex.getResources().getString(R.string.OkButton), new OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { //To change body of implemented methods use File | Settings | File Templates. Log.d(TAG, "onClick"); } }); setView(layout); super.onCreate(savedInstanceState); mMessage = (TextView) findViewById(R.id.text_attack_text_list);//new ListView(mContex); mListView = (ListView) findViewById(R.id.list_attack_text_list);//new ListView(mContex); mMyAdapter = new MyListAdapter(mContex, R.layout.agg_box_open_dlg, mAllGoodsList); mListView.setAdapter(mMyAdapter); } }
相关文章推荐
- Android中自定义的加载对话框和加载条
- Android自定义样式的对话框
- Android自定义对话框
- android自定义普通对话框,输入框对话框
- Android中自定义对话框(Dialog)的实例代码
- Android系统对话框——自定义关闭
- Android开发中如何创建自定义对话框
- android 自定义对话框
- Android AlertDialog 方法setView(view,0,0,0,0)开发自定义对话框
- android Dialog 各种Dialog 三个选项的、进度条的、单选的、多选的、自定义的对话框
- Android自定义对话框(Dialog)位置,大小
- android知识点一:自定义xml对话框
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框的大小
- Android 用户自定义对话框
- android 自定义View【2】对话框取色&色盘取色的实现
- Android自定义对话框(Dialog)位置,大小
- Android 对话框(Dialog) 及 自定义Dialog
- Android 自定义ProgressDialog进度条对话框用法详解
- 在Android中自定义捕获Application全局异常,可以替换掉系统的强制退出对话框(很有参考价值与实用价值)