Many apps have a side scrolling list of views: take the new Twitter highlights feature or even the introduction activity of pretty much every app out there.
The main behaviour I'm looking for is a list of views which contain a mixture of text and images, this list of view scroll horizontally instead of vertically & the views 'lock' so they are fully in view no partially.
Is there a built-in view that I'm unaware of (considering I have only been doing this for a few months now I wouldn't be surprised) or something else entirely
Optional request: along side it how would I support pagination style naviagtion
Is there a built-in view that I'm unaware of or something else entirely ?
Yes
You can use RecyclerView to show Horizontally Scrolling List . You can visit this link to implement RecyclerView .
And to add HORIZONTAL scrolling functionality use this link .
Related
Attached screenshot of netflix app with left side menu I am able to develop a side menu with customized icon and header in it. I want, when the focus comes on header fragment it should expand on top of row fragment, that is not collapsing the row fragment, the same as Netflix and hotstar are doing. How can I achieve it?
unfortunately, the HeaderSupportFragment used in the BrowseSupportFragment is not configurable enough to achieve this kind of design. Leanback is great to build quickly and easily media browser app but when it comes to "complex" design, it's easier to use custom component.
The major difference also here, is that the left menu of the BrowseSupportFragment show each rows header name displayed in the screen (that's why it's called HeaderSupportFragment). Here you want to show different entries like search, home, settings, etc.
To make this kind of view, I would suggest creating your own custom view and use a basic Fragment. I followed this tutorial which can be useful to handle menu open/close animation (I mixed it with a ConstraintLayout to simplify the animation and I made the menu overlap the rest of the screen instead of moving everything.)
See the tutorial: https://medium.com/building-for-android-tv/building-for-android-tv-episode-3-381e041dfec7
I want to create a simple view like this. (red circle)
I searched on internet for Bundling in Recyclerview but I could not find any resources.
Can anyone tell me the name of this view or share any tutorial resources.
Can someone share an example of how to do it. Or any Tutorials on how to get this view . - Bounty question
In recyclerview you can do this with item decoration.
An ItemDecoration allows the application to add a special drawing and
layout offset to specific item views from the adapter's data set. This
can be useful for drawing dividers between items, highlights, visual
grouping boundaries and more.
All ItemDecorations are drawn in the order they were added, before the
item views (in onDraw()) and after the items (in onDrawOver(Canvas,
RecyclerView, RecyclerView.State).
refer here
or
you can design a custom layout and inflate it using getViewByType in
viewholder
I think you better to follow this videos, i am sure my side this videos gives you a perfect idea on Android Recyclerview and also provide a solution for problem.
Please follow this youtube link: https://www.youtube.com/watch?v=XhbsNO2_oDI
ItemDecorator from example below doesn't suite you. Try to use Expandable Listview, which helps you to adjust list, when user tap on image below list item, and expand size for another item, for example, chat messages in your image.
Use This Example!
I'm making a widget that contains values from a feed that is pulled from a mysql database. (fortunatley this is not a problem)
My problem is that I need a scrollview within the widget so that the content can be viewed.
Does Anyone know how I can do this? I know I can't have a scrollview in a widget but need an alternative so that content can be scrolled.
Any help would be appreciated
On Android 3.0 and higher, use a ListView, StackView, etc.
On earlier versions of Android, you cannot scroll, period. All you can do is provide a couple of buttons to rotate the contents of the app widget through your data set.
I want to programatically scroll a View. So far, I have found two possibilities :
scrollTo(x,y) : the top left hand corner of the View corresponds to the point (x,y) of what must be drawn in the View. The problem is that, after the call, it is impossible to manually scroll the View to have it displays what is above y or what is at the left of x.
setScrollY(y) : seems to be the function I'm looking for. But it is only available for API above level 14. And my application is supposed to work with API level 8.
Is there another function which could do what I want to do?
Thanks in advance for the time you will spend trying to help me.
Is your View in a ScrollView? If not, you will need to handle events yourself to manually scroll the View after you use code to set the scroll location. It sounds like you want both manual and programmatic control, so you'll need to use a scrolling container or handle touch events yourself.
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...
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.
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.