1

My app has a profile page. In that page, I have profile and header photos. And have a ListView at below.

My ListView scrolls correctly but not RelativeLayout which contains profile and header photos.

I can't wrap the whole xml with ScrollView because I have ListView at there. It's not reasonable solution.

I want to make the whole page scrollable. I want photos behave like they are items in ListView.

How can I do that?

Thanks in advance.

Note: Of course I looked for it but couldn't find any significant solution. Neither Google nor Stackoverflow could help.

JustWork
  • 1,944
  • 3
  • 22
  • 34

4 Answers4

0

Put the profile and header photos in a relative layout. Change the ListView to a LinearLayout and wrap it all in a ScrollView. Does this work?

a_schimpf
  • 745
  • 1
  • 5
  • 16
  • But when I change ListView to a LinearLayout how do I fill it with textboxes easily like setting ListView's array adapter? I could have to use for loop right? – JustWork May 31 '13 at 21:31
  • yeah, a loop works. it's a pretty simple procedure. just keep doing lView.addView(txtBox) for each TextBox... – a_schimpf May 31 '13 at 21:41
0

overwrite ListView or GridView

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    int expandSpec = MeasureSpec.makeMeasureSpec(  
               Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);  
    super.onMeasure(widthMeasureSpec, expandSpec);
}

that you can write ListView in ScrollView try it

jimbray
  • 11
  • 3
0

Technically you can add listview in a scroll view, and your profile and listview both will scroll but it is neither recommended nor it will show same behavior on all devices.

I think, what you can do is use Expandable listView having 1 parent (which will contain profile+pic) and many children. Here your each listview item will become 1 child. Make child View of expandable listview always visible. Enjoy.

Androider
  • 2,884
  • 5
  • 28
  • 47
0

You can include you headers and profile photos too in your ListView. Basically, you can have a listview with multiple rows with different completely different layouts. Override the methods getViewTypeCount() and getItemViewType(int position in your Adapter. This should start you off in the right direction.

Nitin Sethi
  • 1,416
  • 1
  • 11
  • 19