agony
agony

Reputation: 563

Android layout in java code

i'm making an app that requires indefinite textviews and images. i'm trying to implement a Pulse News app UI but having a hard time implementing one. so i thought of an idea to make a UI like that with the use of textviews, imageview and horizontal scroll view. textview string values are from parsed xml online and images or the imageviews will be images from a specific directory in the sdcard that my app is using.

can anyone give me ideas how can i do it without using an xml layout or is there any or other options or ways for doing this? thanks...

Upvotes: 0

Views: 620

Answers (2)

dcool
dcool

Reputation: 4069

though i dont know what exactly how pulse new app looks like, but by going through your question (horizontal scroll view in particular) I guess you want to implement a "Gallery" type implementation where in you can swipe left/right on page basis.

If my assumption is correct then you will like to see to ViewPager of android backward compatiblity pkg.

Upvotes: 0

Zacharias Manuel
Zacharias Manuel

Reputation: 9013

You can create a viewgroup with one textview and an image. Then it can be added dynamically to your layout many times. This can be done by creating objects in a loop. You can change the content in each viewgroup at the time of inflation.

Upvotes: 2

Related Questions