Source Code|Cloud Tags

Source Code|Cloud Tags

Source code introduction: cloud tag deletion, addition, beautiful style

Download address: http://download..com/data/2194855

Source code effect:

Source code snippet:

  1. package com.niceapp.lib.tagview;
  2.   
  3. import java.util.ArrayList;
  4. import java.util.List;
  5.   
  6. import android.app.Activity;
  7. import android.os.Bundle;
  8. import android.widget.TextView;
  9. import android.widget.Toast;
  10.   
  11. import com.niceapp.lib.tagview.widget.Tag;
  12. import com.niceapp.lib.tagview.widget.TagListView;
  13. import com.niceapp.lib.tagview.widget.TagListView.OnDelClickListener;
  14. import com.niceapp.lib.tagview.widget.TagListView.OnTagClickListener;
  15. import com.niceapp.lib.tagview.widget.TagView;
  16.   
  17. public   class MainActivity extends Activity {
  18.   
  19. private TagListView mTagListView;
  20. private   final List<tag> mTags = new ArrayList<tag>();
  21. private   final String[] titles = { "Safety Essentials" , "Music" , "Parenting" , "Essentials for Office Workers" , "360 Mobile Guard" ,
  22. "QQ" , "input method" , "WeChat" , "most beautiful application" , "AndevUI" , "Mogujie" , "add" };
  23.   
  24. @Override  
  25. protected   void onCreate(Bundle savedInstanceState) {
  26. super .onCreate(savedInstanceState);
  27. setContentView(R.layout.select_tag_activity);
  28.   
  29. mTagListView = (TagListView) findViewById(R.id.tagview);
  30. // mTagListView.setTagViewTextColorRes(Color.parseColor("#ff999999"));  
  31. // mTagListView.setDeleteMode(true);  
  32. setUpData();
  33. mTagListView.setTags(mTags);
  34. mTagListView.setOnTagClickListener( new OnTagClickListener() {
  35.   
  36. @Override  
  37. public   void onTagClick(TagView tagView, Tag tag) {
  38. // TODO Auto-generated method stub  
  39. Toast.makeText(getApplicationContext(), tag.getTitle(),
  40. Toast.LENGTH_LONG).show();
  41.   
  42. for (Tag mTag : mTags) {
  43. if (mTag.equals(tag)) {
  44. mTag.setChecked( true );
  45. } else {
  46. mTag.setChecked( false );
  47. }
  48. }
  49. mTagListView.setTags(mTags);
  50. }
  51. });
  52. mTagListView.setOnDelClickListener( new OnDelClickListener() {
  53.   
  54. @Override  
  55. public   void onDelClick(TextView textView, Tag tag) {
  56. // TODO Auto-generated method stub  
  57. Toast.makeText(MainActivity. this , "Delete" + tag.getTitle(),
  58. Toast.LENGTH_LONG).show();
  59. }
  60. });
  61. }
  62.   
  63. private   void setUpData() {
  64. for ( int i = 0 ; i < titles.length; i++) {
  65. Tag tag = new Tag();
  66. tag.setId(i);
  67. if (i % 2 == 0 ) {
  68. tag.setChecked( true );
  69. } else {
  70. tag.setChecked( false );
  71. }
  72. if (titles[i].equals( "Add" )) {
  73. tag.setShowDel( false );
  74. }
  75. tag.setTitle(titles[i]);
  76. mTags.add(tag);
  77. }
  78. }
  79. }
  80. </tag></tag>

<<:  Source code | Uber's welcome screen

>>:  Many apps ignore Apple's Human Interface Guidelines details

Recommend

6 major points, briefly analyzing Weibo promotion methods!

Weibo is one of the most popular and active socia...

WeChat reminder: These are all plug-in software, please don’t use them

WeChat has become a must-have app for everyone, a...

Live streaming sales trends of major e-commerce companies on Women’s Day!

Live streaming sales have ushered in the first ma...

New world record! This number has been accurate to 105 trillion decimal places

According to the American Fun Science Network, on...

Why do ants move?

"When ants move and snakes cross the road, h...

Better than the built-in file manager in Windows 11? Files App

I think everyone is using Windows' file explo...

Why is the Okolin electric toothbrush not worth buying?

Recently, there have been more and more publicity...

Willows have sprouted. Can they be eaten? How? Where?

Today is Arbor Day, and it is early spring. The &...