zoukankan      html  css  js  c++  java
  • 手机端刮刮乐效果组件ScratchView(android)

    先展示一下效果:

    如何实现:

    1、下载ScratchView组件包:

    2、编码实现:

    #Region  Project Attributes 
    	#ApplicationLabel: B4A Example
    	#VersionCode: 1
    	#VersionName: 
    	'SupportedOrientations possible values: unspecified, landscape or portrait.
    	#SupportedOrientations: unspecified
    	#CanInstallToExternalStorage: False
    #End Region
    
    #Region  Activity Attributes 
    	#FullScreen: False
    	#IncludeTitle: True
    #End Region
    
    
    Sub Process_Globals
    	'These global variables will be declared once when the application starts.
    	'These variables can be accessed from all modules.
    
    End Sub
    
    Sub Globals
    	'These global variables will be redeclared each time the activity is created.
    	'These variables can only be accessed from this module.
    	Private ScratchImageView1 As ScratchImageView
    	Private tvList As List
    	Private Label1 As Label
    End Sub
    
    Sub Activity_Create(FirstTime As Boolean)
    	'Do not forget to load the layout file created with the visual designer. For example:
    	Activity.LoadLayout("Layout3")
    	
    	
    	Dim bmp As Bitmap
    	bmp.Initialize(File.DirAssets,"6343909_191220566100_2.png")
    	Dim d As BitmapDrawable
    	d.Initialize(bmp)
    	ScratchImageView1.ImageDrawable = d
    	
    End Sub
    
    Sub Activity_Resume
    	
    
    End Sub
    
    Sub Activity_Pause (UserClosed As Boolean)
    
    End Sub
    
    
    Sub ScratchImageView1_onRevealed()
    	Log($"ScratchImageView1_onRevealed"$)
    End Sub
    Sub ScratchImageView1_PercentRevealed(percent As Double)
    	Log($"ScratchImageView1_PercentRevealed(${percent})"$)
    End Sub
    
    Sub ScratchText_PercentRevealed(percent As Double)
    	Log($"ScratchImageView1_PercentRevealed(${percent})"$)
    End Sub
    
    Sub ScratchText_onRevealed()
    	Log($"ScratchText_onRevealed"$)		
    	Dim stv As ScratchTextView = Sender
    	Dim amount As Int = stv.Tag
    	Label1.Text = "$"&amount
    End Sub
    
    Sub ScratchText_onScratching(Scratched As Boolean)
    	Log($"ScratchText_onScratching"$)
    	Dim stv As ScratchTextView = Sender
    	For i = 0 To tvList.Size-1
    		Dim s As ScratchTextView = tvList.Get(i)
    		If s <> stv Then
    			s.Visible = False
    		End If
    	Next
    	
    End Sub
    

      

  • 相关阅读:
    C#线程同步lock,Monitor,Mutex,同步事件和等待句柄(1)
    多线程 C#解决方案小结
    10款交互设计原型开发工具
    创建自定义配置节
    禁用外键 oracle
    GUIDESIGNSTUDIO3中文帮助(1)欢迎使用 GUI Design Studio 3.0
    大数据量的数据库设计思考
    gui design studio 3 中文帮助(2)获取帮助
    NHibernate之旅(24):探索NHibernate二级缓存(下)(转)
    客户端原型GUI Design Studio
  • 原文地址:https://www.cnblogs.com/windel/p/8668354.html
Copyright © 2011-2022 走看看