Android Question draggable labels

Smee

Well-Known Member
Licensed User
Longtime User
Is there any examples of draggable views for B4A? I have seen a few for B4i but cannot find any working examples for android

Thanks for any replies
 

Smee

Well-Known Member
Licensed User
Longtime User
I tried he draggable view class and it works fine as is. However I have an unknown number of labels to be created so I use them in a loop and utilise the sender method to access each label. However I am unable to get it working with out dim'ing them in advance. Is there a way around this? Also is it possible to use the same mathod with icons or pictures?

B4X:
    For x = 0 To t
            dbCursor.Position = x
            Played(x) = dbCursor.GetInt("Played")
            Dim lblTeam As DraggableView
           lblTeam.Initialize(Activity, lblTeam)
            lblTeam.Text=dbCursor.GetString("TeamName")
            lblTeam.TextColor=Colors.Black
            lblTeam.Tag=dbCursor.GetInt("TeamIndex")
            If x Mod 2 = 0 Then
                    lblTeam.Color=Colors.Yellow
                    Activity.AddView(lblTeam,1%x,Top,165dip,40dip)
            Else
                    lblTeam.Color=Colors.White
                    Activity.AddView(lblTeam,51%x,Top,165dip,40dip)
                    Top=Top + 60dip
            End If
    Next
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Thanks for the reply, No i had not tried that. I thought that only applied to views already created. Is that not so?
Also how would this be different than a for next loop doing exactly the same thing? Am I missing something here?

Cheers
 
Last edited:
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
Thanks for the reply, No i had not tried that. I thought that only applied to views already created. Is that not so?
yes

I However I am unable to get it working with out dim'ing them in advance. Is there a way around this? Also is it possible to use the same mathod with icons or pictures?
sorry, i didnt quiet understand the question :confused:
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
It appears that the views have to be defined in the editor first and cannot be built dynamically. Is this correct?
 
Upvote 0
Top