资源简介

详情见:http://blog.csdn.net/qq_24867873/article/details/73771817

资源截图

代码片段和文件信息

package com.ayuhani.virtualkeyboarddemo;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import java.util.List;

/**
 * Created by wang on 2017/6/23.
 */

public class KeyboardAdapter extends RecyclerView.Adapter {

    private Context context;
    private List datas;
    private OnKeyboardClickListener listener;

    public KeyboardAdapter(Context context List datas) {
        this.context = context;
        this.datas = datas;
    }

    @Override
    public KeyboardHolder onCreateViewHolder(ViewGroup parent int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_key_board parent false);
        KeyboardHolder holder = new KeyboardHolder(view);
        setListener(holder);
        return holder;
    }

    private void setListener(final KeyboardHolder holder) {
        holder.tvKey.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                if (listener != null) {
                    listener.onKeyClick(view holder holder.getAdapterPosition());
                }
            }
        });
        holder.rlDel.setonclickListener(new View.onclickListener() {
            @Override
            public void onclick(View view) {
                if (listener != null) {
                    listener.onDeleteClick(view holder holder.getAdapterPosition());
                }
            }
        });
    }

    @Override
    public void onBindViewHolder(KeyboardHolder holder int position) {
        if (position == 9) {
            holder.tvKey.setText(datas.get(position));
            holder.tvKey.setBackgroundResource(R.drawable.selector_item_del);
        } else if (position == 11) {
            holder.rlDel.setVisibility(View.VISIBLE);
            holder.tvKey.setVisibility(View.GONE);
        } else {
            holder.tvKey.setText(datas.get(position));
        }
    }

    @Override
    public int getItemCount() {
        return datas == null ? 0 : datas.size();
    }

    class KeyboardHolder extends RecyclerView.ViewHolder {

        public TextView tvKey;
        public RelativeLayout rlDel;
        private View convertView;

        public KeyboardHolder(View itemView) {
            super(itemView);
            convertView = itemView;
            tvKey = itemView.findViewById(R.id.tv_key);
            rlDel = itemView.findViewById(R.id.rl_del);
        }

        public View getconvertView() {
            return convertView;
        }
    }

    public interface OnKeyboardClickListener {

        void onKeyClick(View view RecyclerView.ViewHolder holder int position);

        void onDeleteClick(View view

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        127  2017-06-23 10:29  VirtualKeyboardDemo\.gitignore

     文件       1081  2017-06-23 10:54  VirtualKeyboardDemo\app\build.gradle

     文件        946  2017-06-23 10:29  VirtualKeyboardDemo\app\proguard-rules.pro

     文件        762  2017-06-26 16:28  VirtualKeyboardDemo\app\src\main\AndroidManifest.xml

     文件       3183  2017-06-26 10:59  VirtualKeyboardDemo\app\src\main\java\com\ayuhani\virtualkeyboarddemo\KeyboardAdapter.java

     文件       3427  2017-06-27 11:37  VirtualKeyboardDemo\app\src\main\java\com\ayuhani\virtualkeyboarddemo\KeyboardView.java

     文件       3484  2017-06-27 10:17  VirtualKeyboardDemo\app\src\main\java\com\ayuhani\virtualkeyboarddemo\MainActivity.java

     文件        327  2017-06-27 10:04  VirtualKeyboardDemo\app\src\main\res\anim\keyboard_in.xml

     文件        326  2017-06-27 10:04  VirtualKeyboardDemo\app\src\main\res\anim\keyboard_out.xml

     文件        259  2017-06-26 11:23  VirtualKeyboardDemo\app\src\main\res\drawable\selector_item_del.xml

     文件        254  2017-06-26 11:23  VirtualKeyboardDemo\app\src\main\res\drawable\selector_item_key.xml

     文件       1047  2017-06-27 10:11  VirtualKeyboardDemo\app\src\main\res\layout\activity_main.xml

     文件       1176  2017-06-27 10:11  VirtualKeyboardDemo\app\src\main\res\layout\item_key_board.xml

     文件       1352  2017-06-23 16:16  VirtualKeyboardDemo\app\src\main\res\layout\layout_key_board.xml

     文件       3418  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-hdpi\ic_launcher.png

     文件       4208  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-hdpi\ic_launcher_round.png

     文件       2206  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-mdpi\ic_launcher.png

     文件       2555  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-mdpi\ic_launcher_round.png

     文件       4842  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-xhdpi\ic_launcher.png

     文件       6114  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-xhdpi\ic_launcher_round.png

     文件       7718  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher.png

     文件      10056  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-xxhdpi\ic_launcher_round.png

     文件        869  2016-08-17 00:51  VirtualKeyboardDemo\app\src\main\res\mipmap-xxhdpi\keyboard_back.png

     文件       1271  2016-08-17 00:51  VirtualKeyboardDemo\app\src\main\res\mipmap-xxhdpi\keyboard_delete.png

     文件      10486  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher.png

     文件      14696  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\mipmap-xxxhdpi\ic_launcher_round.png

     文件        454  2017-06-26 11:23  VirtualKeyboardDemo\app\src\main\res\values\colors.xml

     文件         85  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\values\strings.xml

     文件        394  2017-06-23 10:29  VirtualKeyboardDemo\app\src\main\res\values\styles.xml

     文件        521  2017-06-23 10:29  VirtualKeyboardDemo\build.gradle

............此处省略30个文件信息

评论

共有 条评论