android - How to create a scrollable list of items to use with a TabLayout? -


i'd first note first ever proper android app i'm making (i've followed tutorials far), please detailed in answers , forgive me if i'm spouting nonsense :).

i'm trying create app main activity going tablayout, , in 1 of tabs want have fragment list can scroll , down, , each element in list have multiple interactive elements (like 2 different buttons example).

my first instinct go listfragment because each element of list fragment can program whatever want. when following tutorials found listfragments seem rather tricky, , i'm not sure if can make work tablayout.

i've looked other methods, i've found kinds of solutions allow have list of plain views, not fragments.

so should do? there way make listfragment work tablayout , i'm being silly, or there better way this?

my first instinct go listfragment because each element of list fragment can program whatever want

the contents of listfragment not fragments. possible contents of listfragment represent model objects plan on showing other fragments elsewhere in ui.

i'm not sure if can make work tablayout

a listfragment can used inside or outside of tablayout. not think listfragment inside of tablayout particularly more troublesome other sort of fragment.

your listfragment problems come from:

i each element in list have multiple interactive elements (like 2 different buttons example).

listview, underlies listfragment, tricky use interactive elements in list rows. design sounds rather unusual, might wish consider using other ui patterns rather multiple buttons in list rows. if insist upon design, may find recyclerview bit easier in long run, if more challenging @ outset.

i've found kinds of solutions allow have list of plain views, not fragments

that's thing ever going find, in likelihood. again, listfragment fragment contains listview. listview rows not fragments, whether listview contained in fragment or not. thing have ever heard of designed vertical scrolling of fragments various vertical viewpager implementations floating around.


Comments