• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

can't we add two chicld elements to HorizontalScrollView

 
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1)I neded to add a list view with horizontal scrollview.here is the example i used.it's working fine.anyway if i add two linearlayouts it gives error



2)can we use list view inside HorizontalScrollView?
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sameera liyanage wrote:1)I neded to add a list view with horizontal scrollview.here is the example i used.it's working fine.anyway if i add two linearlayouts it gives error


From the API:

A HorizontalScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects.


sameera liyanage wrote:2)can we use list view inside HorizontalScrollView?


Yes. Make sure the two (scroll and list) scroll in different directions, otherwise it gets confusing as to which is moving. Also, to see the horizontal scroll view, you will need to make the elements in the list view wider than the screen.

My guess is you want something else. Can you explain exactly what you want to do?
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to show data with colums and rows.there are several columns and several rows.So my screen is not enough for to show all this data .So i need to have horizontal scroll view.anyway below is my list view without scrollview.

main.xml


main activity

 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sameera liyanage wrote:I need to show data with colums and rows.there are several columns and several rows.So my screen is not enough for to show all this data


You need columns and you need rows? Sounds like you need a GridView.

See:
http://developer.android.com/guide/topics/ui/layout/gridview.html
http://developer.android.com/reference/android/widget/GridView.html
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anyway i have 7 colums and 18 rows exacly.Also i have header column.can i use gridview to archive this.I mean if i use gridview can i archive scrollview also.because ithere are 7 colums and 18 rows it doesn't show all data in one screnn.
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you looked at the resources I gave?
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1)yes Steve i checked.Anyway can we limit the number of columns and rows in gridview.I mean can we define how many columns and rows to show ?

2)anyway i use table layout as below.now i can scroll both sides.but i use textViews.can i use listView for below?

 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sameera liyanage wrote:1)yes Steve i checked.Anyway can we limit the number of columns and rows in gridview.I mean can we define how many columns and rows to show ?


The documentation and the guide both give you the answer to that question.

sameera liyanage wrote:2)anyway i use table layout as below.now i can scroll both sides.but i use textViews.can i use listView for below?


The API for ListView is here: http://developer.android.com/reference/android/widget/ListView.html
The first sentence in the description gives you the answer.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now it seems fine.see the code bwlow.

main.xml



main activity
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic