码迷,mamicode.com
首页 > 移动开发 > 详细

Android 一些基本组件的使用

时间:2015-11-16 22:34:19      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:

Dialog

基本用法 ,带自定义view

AlertDialog dialog = new AlertDialog.Builder(context).setTitle("写入信息")
                .setView(view)
                .setPositiveButton("确认", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {

                    }
                }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
} }) .create(); dialog.show();

 

自定义 Adapter 

    public final class ViewHolder {
        public TextView describe;
        public TextView username;
        public TextView password;
    }
  @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder holder=null;
        if (convertView==null){
            holder = new ViewHolder();
            convertView=mInflater.inflate(R.layout.adapter_account_item,null);
            holder.describe=(TextView)convertView.findViewById(R.id.describe);
            holder.username=(TextView)convertView.findViewById(R.id.username);
            holder.password=(TextView)convertView.findViewById(R.id.password);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        holder.describe.setText(listdata.get(position).getDescribe());
        holder.username.setText(listdata.get(position).getAccount());
        holder.password.setText(listdata.get(position).getPassword());

        return convertView;
    }

 

Android 一些基本组件的使用

标签:

原文地址:http://www.cnblogs.com/baokang/p/4970091.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!