资源简介
详情见: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.xm
文件 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.xm
文件 326 2017-06-27 10:04 VirtualKeyboardDemo\app\src\main\res\anim\keyboard_out.xm
文件 259 2017-06-26 11:23 VirtualKeyboardDemo\app\src\main\res\drawable\selector_item_del.xm
文件 254 2017-06-26 11:23 VirtualKeyboardDemo\app\src\main\res\drawable\selector_item_key.xm
文件 1047 2017-06-27 10:11 VirtualKeyboardDemo\app\src\main\res\layout\activity_main.xm
文件 1176 2017-06-27 10:11 VirtualKeyboardDemo\app\src\main\res\layout\item_key_board.xm
文件 1352 2017-06-23 16:16 VirtualKeyboardDemo\app\src\main\res\layout\layout_key_board.xm
文件 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.xm
文件 85 2017-06-23 10:29 VirtualKeyboardDemo\app\src\main\res\values\strings.xm
文件 394 2017-06-23 10:29 VirtualKeyboardDemo\app\src\main\res\values\st
文件 521 2017-06-23 10:29 VirtualKeyboardDemo\build.gradle
............此处省略30个文件信息
相关资源
- Android登录注册服务器_cookieMonster
- unity3D 蓝牙插件 iOS & Android
- android kotlin付费教程视频 免费提供
- Android应用源码之蓝虫火车票余票查询
- Android应用源码之手机实时视频监控项
- 微信红包插件
- android 注入so代码
- nineoldandroids-2.4.0.jar.zip
- Android CoordinatorLayout打造酷炫的顶部栏
- android自定义混淆字典
- android完美电影购票源码
- 小程序微信支付java后台
- Android应用案例-《垃圾短信助手案例
- Android 自定义漂亮吐司
- SQlite Android SQLite的应用 简易的学生成
- android人脸识别测试用例
- 百度地图 BaiduLBS_Android.jar
- android studio 编译aidl以及demo
- Android SwitchButton开关
- android ChiceScanGun.rar
- Android Flowlayout:LinearLayout内部控件自动
- android-support-design.jar包 程序文件
- 基于Android平台校园信息发布系统
- android屏幕监视器
- Android 倒计时程序源码
- android.support.design.jar-24.2.1jar、doc、s
- android源代码 蓝牙串口助手
- 我的Android进阶之旅------>Android疯狂连
- 微信授权登陆旧版jar包
- Qt仿Android的toast控件效果
评论
共有 条评论