1

I create frames like this. The number can change throughout runtime.

for (i in (1..numStations(serverText)))// number of frames
{
    frame = ScrollView(this@HomeActivity) 
    layoutInflater.inflate(R.layout.frame_layout, frame) 
    frame.tag = i.toString()  
    gridRoot.addView(frame)
}

frame_layout is FrameLayout with some images and texts. I have set focusable and clickable to true on FrameLayout. So I want to detect when a frame is clicked and which one (I added tags starting with 1).

GeoCap
  • 505
  • 5
  • 15
  • 1
    Its better if you use RecyclerView instead. Better in the long run – Branddd Oct 03 '20 at 15:44
  • How difficult is it to change from ScrollView to RecyclerView? I'm having some trouble. – GeoCap Oct 03 '20 at 16:31
  • i suggest that you make a mockup app first that uses the RecyclerView. ScrollView is good for some occasions, but using it with data is kinda off. – Branddd Oct 04 '20 at 08:46

0 Answers0