0

as the title says, I am trying to figure out how to dynamically load imagebuttons using Android Studio. I have already pre-loaded the drawable folder with all of the images I want to make into imagebuttons.

I am using a relativelayout for this app and the main screen will scroll down. I am trying to do this without using the XML file since it seems like it makes it harder to do things dynamically.

How can I create x number of imagebuttons with these conditions? If using the xml folder would make it easier, can someone help me understand it better?

  • You should detect the scroll and then have a RecyclerView or LinearLayout or something like that and add to it the new View (an ImageButton is a View) by inflating it (you can have an xml file and then inflate it) and then adding to the original view. – Joaquin Iurchuk Sep 27 '15 at 05:20

1 Answers1

0

Create a custom ScrollView which find that user reach to bottom. Then inflate your view which have ImageButton. Add that inflated view in your RelativeLayout or LinearLayout which will be inside ScrollView.

Refer this:- Detect end of ScrollView

Community
  • 1
  • 1
Rahul
  • 9,559
  • 4
  • 32
  • 53