Android Question Help with customlistview/ Spinner

anaylor01

Well-Known Member
Licensed User
Longtime User
What I am needing is when the user clicks on the CustomListView/Spinner(Not sure what it will be) it will open a customlistview/Spinner and allow the user to edit text in an edittextbox. Currently it looks like the first picture. But it needs to look like the second. I've uploaded a customlistview project that looks like the second picture. Any help will be appreciated.
Current.png
future.png
 

Attachments

** Edited ...

add these to Main Activity to handle the click event ..
Code: Copy
Sub clv2_ItemClick (Index As Int,Value As Object)
   Log(Index & " = " & Value)
End Sub

Sub Button1_Click
  Log ("You have Clicked Me") 
End Sub

A simple solution to your other problem might be ...
in Click event call sub to display panel containing spinner / edittext to edit team names then update the CLV...
 
Last edited:
Upvote 0
Afterthought .. Do you really need a button in the layout ? .. If not , Do you really need the layout. load the label in code.
The CLV itself NOW handles the ClickEvent ...
Code: Copy
Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel
     Dim p As Panel
     p.Initialize("") 
     p.Color = Colors.Black
 
     Dim lbl As Label
     lbl.Initialize("")   
     lbl.Text =  Text
     lbl.TextSize = clv2.DefaultTextSize  'or whatever
 
     p.AddView(lbl, 20dip, 10dip, 140dip,60dip)
   
   Return p
End Sub

a bit extra for you ...
Code: Copy
  Sub clv2_ItemClick (Index As Int,Value As Object)
     Dim pnl As Panel
     pnl = clv2.GetPanel(Index)

     Dim lbl As Label
     lbl =  pnl.GetView(0)  '0 becuause Label 1st Item added to panel
     lbl.Text = "New Text"
   End Sub
 
Last edited:
Upvote 0
I was wondering what you were talking about when you mentioned a button. But as I was thinking about it there would be no way for the user to tell the app when they were finished editing. So now I am thinking leaving it as a spinner and when they click each team name open up a input box and let them edit the names that way. What do you think?
 
Upvote 0
I was wondering what you were talking about when you mentioned a button. But as I was thinking about it there would be no way for the user to tell the app when they were finished editing. So now I am thinking leaving it as a spinner and when they click each team name open up a input box and let them edit the names that way. What do you think?

Are you only planning on Adding other views later ...??
I have not tested .. but why not put Edit Text on CLV and they could edit it directly

Edit .... Have attached small sample of CLV with EditText.
 

Attachments

Last edited:
Upvote 0
I was wondering what you were talking about when you mentioned a button. But as I was thinking about it there would be no way for the user to tell the app when they were finished editing. So now I am thinking leaving it as a spinner and when they click each team name open up a input box and let them edit the names that way. What do you think?

Sorry just re-read your post .. I have not used a spinner so can't comment , but it sounds simpler than using CLV just for a Label or EditText

Cheers
 
Upvote 0
Hey Mango. I like what you did. Now can you tell me how when the user clicks on the edt it clears the existing text? Also on my current project in the designer I click on add view and Customview is greyed out.
 
Upvote 0
Hey Mango. Now can you tell me how when the user clicks on the edt it clears the existing text?
Code: Copy
Sub Edt_FocusChanged (HasFocus As Boolean)
   If HasFocus Then Edt.text = ""
End Sub


IT won't be an CLV it will be a spinner.
Also on my current project in the designer I click on add view and Customview is greyed out.
See new thread Here ...

I'm slightly confused ... Are you planning to use CLV now ? ... Have you added CustomListView class to your project.
If Not , that will explain why .. Designer Menu > Add View > Custom View is greyed out.

It might be easier to upload current project or example.
 
Last edited:
Upvote 0
I guess I am going to use an input box but I need to know how to take the result and put it in the right place of the spinner.
 
Upvote 0
Back
Top