SpinnerItem:分类 SpinnerItem TagAdapter 相关参考:Android记事本NotePad应用功能拓展(一)
Android记事本NotePad应用功能拓展(三)
一、实现功能
1.笔记分类(Note)
二、项目代码分析
1.标签类相关代码
相关类分析
TagAdapterr:连接Tag数据库的适配器接口package com.example.atry; public class SpinnerItem { private String tagName; private int tagId; public SpinnerItem(String tagName, int tagId) { this.tagName = tagName; this.tagId = tagId; } public String getTagName() { return tagName; } public void setTagName(String tagName) { this.tagName = tagName; } public int getTagId() { return tagId; } public void setTagId(int tagId) { this.tagId = tagId; } }
package com.example.atry; import android.content.Context; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.List; public class TagAdapter extends BaseAdapter { private Context context; private List<String> tagList; private List<Integer> numList; public TagAdapter(Context context, List<String> tagList, List<Integer> numList) { this.context = context; this.tagList = tagList; this.numList = numList; } @Override public int getCount() { return tagList.size(); } @Override public Object getItem(int position) { return tagList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { for(int i = 0; i < numList.size(); i++) Log.d("tag", numList.get(i).toString()); Log.d("tag", "getView: " + numList.size()); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); context.setTheme((sharedPreferences.getBoolean("nightMode", false)? R.style.NightTheme: R.style.DayTheme)); View v = View.inflate(context, R.layout.tag_layout, null); TextView blank_tag = v.findViewById(R.id.blank_tag); TextView text_tag = v.findViewById(R.id.text_tag); ImageView delete_tag = v.findViewById(R.id.delete_tag); blank_tag.setText(numList.get(position).toString()); text_tag.setText(tagList.get(position)); return v; } }
三、参考资料
作者GitHub下载链接:https://github.com/KangKangBigWorld/Android/tree/master/Mid_Test
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算