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

Google accidentally releases first 'release candidate' of Fuchsia OS

Developers have been watching and eagerly awaitin...

WeChat upgraded with new features: My three-year-old phone is no longer stuck!

Regardless of the model, high configuration or lo...

Zhihu’s road to commercial monetization!

From launching the live streaming function to the...

E-commerce agent operation: Do you want to find an agent to operate?

1. Think outside the box of operations and look a...

How to operate private domain? 7 ways to operate private domain!

Private domains are very popular, but the informa...

The "dark mode" you see in iOS 13 is actually not eye protection

The bright white background is gradually being re...

The next stage of self-driving cars: You can take a nap in the car

According to foreign media reports, the problem w...

Summary of issues regarding live broadcast advertising

【Q1】 We are engaged in direct investment in funct...

WeChat Card and Coupon Interface

This update of WeChat public platform adds WeChat...